Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
Subject: `touch' created wrong file without giving error
Organization: Private
From: pjacklam@online.no (Peter J. Acklam)
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Date: 04 Jun 2004 08:41:37 +0200
Message-ID: <vfi74yfy.fsf@online.no>
Lines: 27
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-IsSubscribed: yes

I tried creating a file named " foo ", i.e., with two leading and
two trailing blanks using "touch".  It turned out that "touch"
created the file, but without the two trailing blanks.  It might
be that a file name with trailing blanks can't be created on an
NTFS file system, but "touch" shouldn't create the wrong file but
rather give an error telling that it failed.  Silently creating
the wrong name is generally bad:

   $ touch '  foo  '
   $ echo $?
   0
   $ for file in *foo*; do echo "|$file|"; done
   |  foo|
        ^^

"touch" returned exit status 0, but failed to create the file.
"ls" also shows that the file only has the leading blanks:

   $ ls -b *foo*
   \ \ foo

Should "touch" return an error when it fails?

Peter

-- 
Peter J. Acklam - pjacklam@online.no - http://home.online.no/~pjacklam



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

