This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: other/2141: set -C in gccbug not portable
Joseph S. Myers writes:
> On Thu, 1 Mar 2001, Rainer Orth wrote:
>
> > gccbug uses set -C to avoid overwriting files with I/O redirection.
> > Unfortunately, this isn't portable: none of Solaris 2.8, IRIX 6.2, or
> > Tru64 UNIX V5.1 /bin/sh support it, while bash and ksh do.
>
> Does this cause gccbug to exit at the set -C, or simply an unsightly error
> message?
gccbug just exits:
% /bin/uname -a
OSF1 bartok V5.1 732 alpha
% /bin/sh ./gccbug
./gccbug: -C: bad option(s)
% echo $?
1
> Is there a recommended method to create temporary files securely from
> shell scripts on these systems?
How about using a different approach: creating a unique temporary directory
and storing the gccbug temp files there? This shouldn't be vulnerable to
temp races and doesn't rely on non-portable options either.
> I think the appropriate fix is for configure to look for a working POSIX
> shell (such as bash or ksh) on systems lacking the mktemp command and set
> -C.
I don't think this is an appropriate solution. Consider systems which lack
all of those: we shouln't force users of such systems to install bash just
to produce a gcc bug report.
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: ro@TechFak.Uni-Bielefeld.DE