Subject: bug#15819: colorls.csh errors out if "noclobber" is set (coreutils 8.21.11, Fedora19)

From: "Ty! Boyack" <[email-masked]>
Date: Wed, 06 Nov 2013 00:00:12 -0700

Behavior:

The setup script /etc/profile.d/colorls.csh works fine in a stock F19
installation, but if a local admin adds a default shell setting of
"noclobber" in a profile setting that runs before this script (as we do)
then the script will error out with an error of:

/tmp/.colorlsXXX: File exists.

Cause:

The script creates that temporary file with mktemp, but on the first
write it uses only a single redirect (>), which fails when noclobber is set.

Since the file is already created, I think we can safely use an append
redirect (>>) in all cases where that file is written to, which works
regardless of the state of the noclobber settting.

Patch:

35c35
< if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $TMP
---
> if ( "$INCLUDE" != '' ) cat "$INCLUDE" >> $TMP

Disclaimer:

I know this is not against the latest source, but I did not see anything
in the bug lists regarding this.  My apologies if this has already been
looked at and fixed or dismissed.

Cheers to all,

-Ty!