Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 2010 21:00:09 -0800
From:      Freddie Cash <fjwcash@gmail.com>
To:        freebsd-fs@freebsd.org
Subject:   Re: Unable to pwd in ZFS snapshot
Message-ID:  <b269bc571002032100t1de0bdc4g2fc0f1e2a17f2199@mail.gmail.com>
In-Reply-To: <4b473c1f1002032014y4da8c0f0xcb74c749332cced3@mail.gmail.com>
References:  <4b473c1f1002032014y4da8c0f0xcb74c749332cced3@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 3, 2010 at 8:14 PM, Randy Sofia <randysofia@gmail.com> wrote:

> `pwd` returns "No such file or directory" when browsing snapshot files.
> This
> was addressed in:
> http://lists.freebsd.org/pipermail/fr<http://lists.freebsd.org/pipermail/freebsd-fs/2009-February/005675.html>;
>
>>
>> --randy
>> _______________________________________________
>> freebsd-fs@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
>> To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"
>>
> eebsd-fs/2009-February/005675.html<http://lists.freebsd.org/pipermail/freebsd-fs/2009-February/005675.html>; but
> remains the same as of 8.0-RELEASE.
>
> I am wondering if this is the expected behavior or if this was left by the
> wayside.
>
> A work around is available as per the previous discussion:
> zfs set snapdir=visible volume
>
> Reproducible behavior:
> CANAAN# zfs snapshot pithos/media@0_day_ago
> CANAAN# cd /pithos/media/.zfs/snapshot/0_day_ago/
> CANAAN# pwd
> pwd: .: No such file or directory
> CANAAN# uname -a
> FreeBSD CANAAN 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Fri Dec 18 00:38:33 UTC
> 2009     root@:/usr/obj/usr/src/sys/CANAAN  amd64
>

I believe this is a "bug" in csh, in that it doesn't have a pwd shell
built-in, and uses /bin/pwd.  The real issue lies in /bin/pwd.

It works correctly in sh, zsh, and bash, which each have pwd built-ins.  As
a workaround, use a non-csh-based shell.  :)

Doing a truss on /bin/pwd when in /home/.zfs/snapshot/2009-12-31 (I snapshot
/home daily) gives the following with snapdir=hidden:

__getcwd(0x28201400,1024)                        ERR#2 'No such file or
directory'
stat("/",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0 (0x0)
lstat(".",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0)
stat("..",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0)
open("..",O_NONBLOCK,05001200603)                = 3 (0x3)
fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0)
fcntl(3,F_SETFD,FD_CLOEXEC)                      = 0 (0x0)
__sysctl(0x84bfe6a8,0x2,0x281994bc,0x84bfe6b0,0x0,0x0) = 0 (0x0)
fstatfs(0x3,0x84bfe780,0x1,0x0,0x3,0x28073c94)   = 0 (0x0)
fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x28086400) = 1164
(0x48c)
lstat("../2010-01-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-07",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-13",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-19",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-02-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lseek(3,0x0,SEEK_SET)                            = 0 (0x0)
close(3)                                         = 0 (0x0)
lstat("../",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0)
stat("../..",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0)
open("../..",O_NONBLOCK,05001200603)             = 3 (0x3)
fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0)
fcntl(3,F_SETFD,FD_CLOEXEC)                      = 0 (0x0)
fstatfs(0x3,0x84bfe780,0x1,0x0,0x3,0x28073c94)   = 0 (0x0)
fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 44
(0x2c)
lseek(3,0x0,SEEK_SET)                            = 0 (0x0)
close(3)                                         = 0 (0x0)
lstat("../../",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0)
stat("../../..",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0)
open("../../..",O_NONBLOCK,03777777)             = 3 (0x3)
fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0)
fcntl(3,F_SETFD,FD_CLOEXEC)                      = 0 (0x0)
fstatfs(0x3,0x84bfe780,0x1,0x0,0x3,0x28073c94)   = 0 (0x0)
fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 56
(0x38)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 0
(0x0)
lseek(3,0x0,SEEK_SET)                            = 0 (0x0)
close(3)                                         = 0 (0x0)


And gives the following when snapdir=visible:
__getcwd(0x28201400,1024)                        ERR#2 'No such file or
directory'
stat("/",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0
(0x0)
lstat(".",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
stat("..",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0
(0x0)
open("..",O_NONBLOCK,05001200603)                = 3
(0x3)
fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0
(0x0)
fcntl(3,F_SETFD,FD_CLOEXEC)                      = 0
(0x0)
__sysctl(0x84bfe6f8,0x2,0x281994bc,0x84bfe700,0x0,0x0) = 0
(0x0)
fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94)   = 0
(0x0)
fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0
(0x0)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x28086400) = 1164
(0x48c)
lstat("../2010-01-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-07",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-13",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-19",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-02-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2010-01-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lstat("../2009-12-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
lseek(3,0x0,SEEK_SET)                            = 0
(0x0)
close(3)                                         = 0
(0x0)
lstat("../",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0
(0x0)
stat("../..",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0
(0x0)
open("../..",O_NONBLOCK,05001200603)             = 3
(0x3)
fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0
(0x0)
fcntl(3,F_SETFD,FD_CLOEXEC)                      = 0
(0x0)
fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94)   = 0
(0x0)
fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0
(0x0)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 44
(0x2c)
lseek(3,0x0,SEEK_SET)                            = 0
(0x0)
close(3)                                         = 0
(0x0)
lstat("../../",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0
(0x0)
stat("../../..",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
open("../../..",O_NONBLOCK,03777777)             = 3
(0x3)
fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
fcntl(3,F_SETFD,FD_CLOEXEC)                      = 0
(0x0)
fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94)   = 0
(0x0)
fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 72
(0x48)
lseek(3,0x0,SEEK_SET)                            = 0
(0x0)
close(3)                                         = 0
(0x0)
lstat("../../../",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0
(0x0)
stat("../../../..",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0
(0x0)
open("../../../..",O_NONBLOCK,03777777)          = 3
(0x3)
fstat(3,{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0
(0x0)
fcntl(3,F_SETFD,FD_CLOEXEC)                      = 0
(0x0)
fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94)   = 0
(0x0)
fstat(3,{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0
(0x0)
getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x489629aa,0x0) = 512
(0x200)
lstat("../../../../.snap",{ mode=drwxrwxr-x ,inode=3,size=512,blksize=4096
}) = 0 (0x0)
lstat("../../../../dev",{ mode=dr-xr-xr-x ,inode=2,size=512,blksize=4096 })
= 0 (0x0)
lstat("../../../../etc",{ mode=drwxr-xr-x
,inode=141312,size=2560,blksize=4096 }) = 0 (0x0)
lstat("../../../../cdrom",{ mode=drwxr-xr-x
,inode=211968,size=512,blksize=4096 }) = 0 (0x0)
lstat("../../../../bin",{ mode=drwxr-xr-x
,inode=23552,size=1024,blksize=4096 }) = 0 (0x0)
lstat("../../../../boot",{ mode=drwxr-xr-x
,inode=164864,size=1024,blksize=4096 }) = 0 (0x0)
lstat("../../../../lib",{ mode=drwxr-xr-x
,inode=70656,size=2048,blksize=4096 }) = 0 (0x0)
lstat("../../../../libexec",{ mode=drwxr-xr-x
,inode=117760,size=512,blksize=4096 }) = 0 (0x0)
lstat("../../../../media",{ mode=drwxr-xr-x
,inode=94208,size=512,blksize=4096 }) = 0 (0x0)
lstat("../../../../mnt",{ mode=drwxr-xr-x
,inode=188416,size=512,blksize=4096 }) = 0 (0x0)
lstat("../../../../proc",{ mode=dr-xr-xr-x
,inode=117763,size=512,blksize=4096 }) = 0 (0x0)
lstat("../../../../rescue",{ mode=drwxr-xr-x
,inode=23590,size=2560,blksize=4096 }) = 0 (0x0)
lstat("../../../../root",{ mode=drwxr-xr-x
,inode=211969,size=1024,blksize=4096 }) = 0 (0x0)
lstat("../../../../sbin",{ mode=drwxr-xr-x
,inode=47105,size=2560,blksize=4096 }) = 0 (0x0)
lstat("../../../../tmp",{ mode=drwxrwxrwt ,inode=3,size=26,blksize=4096 }) =
0 (0x0)
lstat("../../../../usr",{ mode=drwxr-xr-x ,inode=11,size=512,blksize=4096 })
= 0 (0x0)
lstat("../../../../var",{ mode=drwxr-xr-x ,inode=3,size=25,blksize=4096 }) =
0 (0x0)
lstat("../../../../restoresymtable",{ mode=-rw-------
,inode=4,size=1948892,blksize=4096 }) = 0 (0x0)
lstat("../../../../sys",{ mode=lrwxr-xr-x ,inode=8,size=11,blksize=4096 }) =
0 (0x0)
lstat("../../../../COPYRIGHT",{ mode=-r--r--r--
,inode=12,size=6198,blksize=4096 }) = 0 (0x0)
lstat("../../../../compat",{ mode=lrwxrwxrwx ,inode=7,size=10,blksize=4096
}) = 0 (0x0)
lstat("../../../../home",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) =
0 (0x0)
lseek(3,0x0,SEEK_SET)                            = 0
(0x0)
close(3)                                         = 0
(0x0)
lstat("../../../../",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0
(0x0)
fstat(1,{ mode=crw--w---- ,inode=145,size=0,blksize=4096 }) = 0
(0x0)
ioctl(1,TIOCGETA,0x84bfea10)                     = 0
(0x0)
/home/.zfs/snapshot/2009-12-31

write(1,"/home/.zfs/snapshot/2009-12-31\n",31)   = 31
(0x1f)


-- 
Freddie Cash
fjwcash@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b269bc571002032100t1de0bdc4g2fc0f1e2a17f2199>