[RndTbl] ls auto-quote rant

Bill Reid billreid at shaw.ca
Sat Feb 4 16:41:04 CST 2017


Filenames with spaces are problematic and I avoid if I can. Not sure if this 
change would have prevented a problem from the past.

In the days of MBnet(early 1990s) one of the sysadmins wrote a script to clean 
out /tmp. It was successfully running for a few weeks but one weekend the system 
crashed with most of the file system deleted. Of course I initially thought we 
were hacked but could find no evidence of it. Next weekend the same thing 
happened. At this point I called for help and we had all of the Unix support 
people on the Eng 6th floor in trying to figured it out. Gary Mills finally 
discovered a rm command in a memory dump. It was removing directories/files 
under /tmp/.. which of course is /. He realised what was happening. Because we 
had disk quotas a user created a directory with the name  '/tmp/ ..' to save 
their files.  If you did an ls on /tmp you would see a .. file with a leading 
space which was of course was misleading.  If that filename was enclosed with 
quotes it would have been easily identified and also perhaps the script to clean 
up /tmp would not have failed.

-- Bill

On 2017-02-04 12:47 AM, Trevor Cordes wrote:
> Fedora 24 (and all cutting-edge distros) has a nice surprise:
>
>> touch filenospace
>> touch file\ with\ spaces
>> /bin/ls
> 'file with spaces'  filenospace


More information about the Roundtable mailing list