Hi, sorry for the delay replying.
I've no idea what's happening here - my experience of the sticky bit is
pretty much limited to following instructions in documentation
and security alerts.
Some questions:
Isn't the "sticky bit" also known as the "set user id bit".
Which user are you running as?
Which user owns the script?
Which user owns runhugs?
What are the permissions on runhugs and on the script?
What's the interaction between shebang and the sticky bit?
It must be documented somewhere...
Alastair
ps If you always get bad error messages from runhugs, it might be that
your system doesn't support snprintf and vsnprintf
(watch closely while configuring Hugs to find out or look in config.h)
In that case, Hugs uses this pathetic but safe approximation of
snprintf:
#if !defined(HAVE_VSNPRINTF)
int vsnprintf(buffer, count, fmt, ap)
char* buffer;
int count;
const char* fmt;
va_list ap; {
#if defined(HAVE__VSNPRINTF)
return _vsnprintf(buffer, count, fmt, ap);
#else
return 0;
#endif
}
#endif /* HAVE_VSNPRINTF */
#if !defined(HAVE_SNPRINTF)
int snprintf(char* buffer, int count, const char* fmt, ...) {
#if defined(HAVE__VSNPRINTF)
int r;
va_list ap; /* pointer into argument list */
va_start(ap, fmt); /* make ap point to first arg after fmt */
r = vsnprintf(buffer, count, fmt, ap);
va_end(ap); /* clean up */
return r;
#else
return 0;
#endif
}
#endif /* HAVE_SNPRINTF */
If buffer overflows don't worry you, you might replace this with
something more useful but note that it's used in a situation where
buffer overflows _will happen often_ so you can't just call
snprintf. Testing that count <= 500 might be fairly safe.
> The following script works fine (no matter if the environment variable exists or
> not) until you set its sticky bit. Then it just responds with
> runhugs:
>
>
> #!/usr/local/bin/runhugs
>
> module Main(main) where
>
> import System
>
>
> main :: IO ()
> main = do
> r <- catch (getEnv "EDITOR") (\_-> return "Nothing")
> putStr r
> putStr "End\n"
>
>
> If you write a shell script which calls runhugs with the script above, then it
> works, independent of the setting of the sticky bit.
>
> This problem arises when you write cgi-scripts with the sticky bit.
>
> Can you explain the behaviour?
> By the way, it would be nice if runhugs gave more verbose error messages ;-)