zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#510038: zsh: glob qualifer - doesn't work correctly on dangling symlinks
       [not found] <20081228214141.GA7972@ay.vinc17.org>
@ 2008-12-29  3:41 ` Clint Adams
  2008-12-29  4:32   ` Vincent Lefevre
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2008-12-29  3:41 UTC (permalink / raw)
  To: Vincent Lefevre, 510038; +Cc: zsh-workers

On Sun, Dec 28, 2008 at 10:41:41PM +0100, Vincent Lefevre wrote:
> The glob qualifer - doesn't work correctly on dangling symlinks.
> For instance:
> 
> $ zsh <<EOF
> set -ex
> echo $ZSH_VERSION
> mkdir globtest-dir
> cd globtest-dir
> touch file1
> chmod 644 file1
> ln -s file1 file2
> ln -s file0 file3
> ls -l file*
> ls -l file*(-W)
> EOF
> 
> gives:
> 
> +zsh:2> echo 4.3.6
> 4.3.6
> +zsh:3> mkdir globtest-dir
> +mkdir:0> mkdir globtest-dir
> +zsh:4> cd globtest-dir
> +zsh:5> touch file1
> +zsh:6> chmod 644 file1
> +zsh:7> ln -s file1 file2
> +ln:0> ln -s file1 file2
> +zsh:8> ln -s file0 file3
> +ln:0> ln -s file0 file3
> +zsh:9> ls -l file1 file2 file3
> -rw-r--r-- 1 lefevre lefevre 0 2008-12-28 22:34:28 file1
> lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file2 -> file1
> lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file3 -> file0
> +zsh:10> ls -l file3
> lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file3 -> file0
> 
> file*(-W) should have no matches.
> 
> zsh 4.3.9 on my Mac OS X machine behaves correctly.

Are you sure? Is the stat() call succeeding on MacOS even if the
link is dangling?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug#510038: zsh: glob qualifer - doesn't work correctly on dangling symlinks
  2008-12-29  3:41 ` Bug#510038: zsh: glob qualifer - doesn't work correctly on dangling symlinks Clint Adams
@ 2008-12-29  4:32   ` Vincent Lefevre
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Lefevre @ 2008-12-29  4:32 UTC (permalink / raw)
  To: zsh-workers; +Cc: 510038

On 2008-12-29 03:41:14 +0000, Clint Adams wrote:
> On Sun, Dec 28, 2008 at 10:41:41PM +0100, Vincent Lefevre wrote:
[...]
> > +zsh:9> ls -l file1 file2 file3
> > -rw-r--r-- 1 lefevre lefevre 0 2008-12-28 22:34:28 file1
> > lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file2 -> file1
> > lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file3 -> file0
> > +zsh:10> ls -l file3
> > lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file3 -> file0
> > 
> > file*(-W) should have no matches.
> > 
> > zsh 4.3.9 on my Mac OS X machine behaves correctly.
> 
> Are you sure? Is the stat() call succeeding on MacOS even if the
> link is dangling?

Here's the kdump on Mac OS X:

  7035 zsh      CALL  lstat(0xbfffb0d9,0xbfffb54c)
  7035 zsh      NAMI  "file1"
  7035 zsh      RET   lstat 0
  7035 zsh      CALL  lstat(0xbfffb0d9,0xbfffb54c)
  7035 zsh      NAMI  "file2"
  7035 zsh      RET   lstat 0
  7035 zsh      CALL  stat(0xbfffb0d9,0xbfffb5ac)
  7035 zsh      NAMI  "file2"
  7035 zsh      RET   stat 0
  7035 zsh      CALL  lstat(0xbfffb0d9,0xbfffb54c)
  7035 zsh      NAMI  "file3"
  7035 zsh      RET   lstat 0
  7035 zsh      CALL  stat(0xbfffb0d9,0xbfffb5ac)
  7035 zsh      NAMI  "file3"
  7035 zsh      RET   stat -1 errno 2 No such file or directory
  7035 zsh      CALL  getdirentries(0x3,0x1807800,0x1000,0x409594)
  7035 zsh      RET   getdirentries 0
  7035 zsh      CALL  lseek(0x3,0,0)
  7035 zsh      RET   lseek 0
  7035 zsh      CALL  close(0x3)
  7035 zsh      RET   close 0
  7035 zsh      CALL  ioctl(0x2,0x4004667a ,0xbfffb6a8)
  7035 zsh      RET   ioctl 0
  7035 zsh      CALL  write(0x2,0x87b24,0x21)
  7035 zsh      GIO   fd 2 wrote 33 bytes
       "zsh: no matches found: file*(-W)
       "

Seems OK.

BTW, there's a bug earlier: a file is closed twice:

  7028 zsh      CALL  write(0x2,0x87b24,0x13)
  7028 zsh      GIO   fd 2 wrote 19 bytes
       "+zsh:2> echo 4.3.9
       "
  7028 zsh      RET   write 19/0x13
  7028 zsh      CALL  write(0x1,0x87f24,0x6)
  7028 zsh      GIO   fd 1 wrote 6 bytes
       "4.3.9
       "
  7028 zsh      RET   write 6
  7028 zsh      CALL  close(0xd)
  7028 zsh      RET   close 0
  7028 zsh      CALL  close(0xd)
  7028 zsh      RET   close -1 errno 9 Bad file descriptor

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-29  4:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20081228214141.GA7972@ay.vinc17.org>
2008-12-29  3:41 ` Bug#510038: zsh: glob qualifer - doesn't work correctly on dangling symlinks Clint Adams
2008-12-29  4:32   ` Vincent Lefevre

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).