Subject: bin/10384: ls(1) fails on symlinks with newlines in name
To: None <gnats-bugs@gnats.netbsd.org>
From: Ben Harris <bjh21@cam.ac.uk>
List: netbsd-bugs
Date: 06/17/2000 07:04:17
>Number:         10384
>Category:       bin
>Synopsis:       ls(1) fails on symlinks with newlines in name
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 17 07:05:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ben Harris
>Release:        unknown -- 1999-11ish
>Organization:
	University of Cambridge
>Environment:
NetBSD cromarty 1.4X NetBSD 1.4X (CROMARTY) #9: Wed May  3 23:49:51 BST 2000
     bjh21@cromarty:/usr/src/sys/arch/macppc/compile/CROMARTY macppc

>Description:
If I create a symlink (on ffs) whose name contains a newline (ASCII
LF) character, "ls -l" fails to display the contents of the link
correctly, giving "No such file or directory".  The message seems to
indicate that ls is passing the filename to readlink() after replacing odd
characters with question marks.  Sending the output of ls through
"cat" (to disable -q) works around the problem.

>How-To-Repeat:
cromarty:/tmp$ ln -s "one line" "two
> lines"
cromarty:/tmp$ ls -l "two
> lines"

ls: two?lines: No such file or directory
lrwxrwxr-x  1 bjh21  wheel  8 Jun 17 15:02 two?lines
cromarty:/tmp$ ls -l "two
> lines" | cat
lrwxrwxr-x  1 bjh21  wheel  8 Jun 17 15:02 two
lines -> one line

-- 
Ben Harris
Unix Support, University of Cambridge Computing Service.


>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: