Bug in command test

2008-09-18 Thread Abhishek Verma
Hi,

I have been training UNIX for a few months, and have come across a bug (I guess 
so)
With test command.

The problem is, with -f option it reports a symbolic link as a regular file.
For ex: say there is a file f1 of type symbolic link, then

If [ -f f1 ]; then
Echo reg file
Else
Echo Not reg file
Fi

The above code should give output as : Not reg file
But it happens to print reg file.

I hope you would be able to help me with this.


Thanks and Regards,
Abhishek Kumar Verma



DISCLAIMER
The information transmitted is intended exclusively for the person or entity to 
which it is addressed and may contain confidential and/or privileged material. 
Any review, retransmission, dissemination or other use of, or taking of any 
action in reliance upon, this information by persons or entities other than the 
intended recipient is prohibited. If you are not the intended recipient or have 
received this mail in error, please notify the sender immediately and delete 
the material from your system.
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Bug in command test

2008-09-18 Thread Philip Rowlands

On Thu, 18 Sep 2008, Abhishek Verma wrote:

I have been training UNIX for a few months, and have come across a bug 
(I guess so) With test command.


The problem is, with -f option it reports a symbolic link as a regular 
file. For ex: say there is a file f1 of type symbolic link, then


   If [ -f f1 ]; then
   Echo reg file
   Else
   Echo Not reg file
   Fi

The above code should give output as : Not reg file
But it happens to print reg file.


This is not a bug - the manpage for test states:
  Except for -h and -L, all FILE-related tests dereference symbolic
   links.

If the filename passed to test is a symlink, the target of the link is 
tested as a file/directory/etc.



Cheers,
Phil


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Bug in command test

2008-09-18 Thread Andreas Schwab
Abhishek Verma [EMAIL PROTECTED] writes:

 I have been training UNIX for a few months, and have come across a bug (I 
 guess so)
 With test command.

Note that you are more likely using the built-in command of the shell,
not the one provided by coreutils, though that would not make a
difference in this case.

 The problem is, with -f option it reports a symbolic link as a regular file.

From the coreutils documentation:

`-h FILE'
`-L FILE'
 True if FILE exists and is a symbolic link.  Unlike all other
 file-related tests, this test does not dereference FILE if it is a
 symbolic link.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: final batch of tiny string fixes [patches]

2008-09-18 Thread Benno Schulenberg
Benno Schulenberg wrote:
 Attached the last of the series of tiny fixes for string problems

Ping?

Benno


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils