All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: weird bash autocomplete issue
@ 2008-12-16 20:46 devzero
  2008-12-16 21:41 ` Kay Sievers
  0 siblings, 1 reply; 15+ messages in thread
From: devzero @ 2008-12-16 20:46 UTC (permalink / raw)
  To: Kay Sievers; +Cc: linux-btrfs

> On Tue, Dec 16, 2008 at 20:37, Roland <devzero@web.de> wrote:
> > i have come across a weird autocomplete issue i assume it is relate=
d to
> > btrfs.
> >
> > let`s have some dirs:
> >
> > /non-btrfs-mount
> >   ./linux
> >   ./testdir
> >
> > /brtfs-mount
> >   ./linux
> >   ./testdir
> >
> > now, if i do "cd t<tab>" in /non-btrfs-mount, "t" autocompletes to =
"testdir"
> > same for l<tab>inux - bash autocompletes as expected.
> >
> > now, the weird thing is, that on /btrfs-mount this behaves differen=
t.
> >
> > autocompletion for testdir works, but not for linux dir. weird.
> >
> > can someone reproduce this ?
>=20
> Open another shell, find the bash process pid of the first shell with=
:
>   ps afx
> and do:
>   strace -p <pid>
> Go back to the first shell, hit <tab>, and the trace should show
> what's going on. You see a significant difference there?


ok, here we go (i hope i did not cut important parts).
i don`t see the real issue, but i did another interesting finding - see=
 below


bad (cd l<tab>):

open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) =3D 3
fstat64(3, {st_dev=3Dmakedev(0, 19), st_ino=3D256, st_mode=3DS_IFDIR|05=
55, st_nlink=3D1, st_uid=3D0, st_gid=3D0, st_blksize=3D4096, st_blocks=3D=
8, st_size=3D18, st_atime=3D2008/12/16-21:32:38, st_mtime=3D2008/12/16-=
21:32:37, st_ctime=3D2008/12/16-21:32:37}) =3D 0
getdents64(3, {{d_ino=3D256, d_off=3D2, d_type=3DDT_DIR, d_reclen=3D24,=
 d_name=3D"."} {d_ino=3D256, d_off=3D2, d_type=3DDT_DIR, d_reclen=3D24,=
 d_name=3D".."} {d_ino=3D257, d_off=3D3, d_type=3DDT_DIR, d_reclen=3D24=
, d_name=3D"test"} {d_ino=3D258, d_off=3D9223372036854775807, d_type=3D=
DT_DIR, d_reclen=3D32, d_name=3D"linux"}}, 4096) =3D 104
_llseek(3, 3, [3], SEEK_SET)            =3D 0
getdents64(3, {{d_ino=3D258, d_off=3D9223372036854775807, d_type=3DDT_D=
IR, d_reclen=3D32, d_name=3D"linux"}}, 4096) =3D 32
close(3)                                =3D 0
write(2, "\7", 1)                       =3D 1
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  =3D 0

good (cd t<tab>):

open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) =3D 3
fstat64(3, {st_dev=3Dmakedev(0, 19), st_ino=3D256, st_mode=3DS_IFDIR|05=
55, st_nlink=3D1, st_uid=3D0, st_gid=3D0, st_blksize=3D4096, st_blocks=3D=
8, st_size=3D18, st_atime=3D2008/12/16-21:38:13, st_mtime=3D2008/12/16-=
21:38:11, st_ctime=3D2008/12/16-21:38:11}) =3D 0
getdents64(3, {{d_ino=3D256, d_off=3D2, d_type=3DDT_DIR, d_reclen=3D24,=
 d_name=3D"."} {d_ino=3D256, d_off=3D2, d_type=3DDT_DIR, d_reclen=3D24,=
 d_name=3D".."} {d_ino=3D257, d_off=3D3, d_type=3DDT_DIR, d_reclen=3D24=
, d_name=3D"test"} {d_ino=3D258, d_off=3D9223372036854775807, d_type=3D=
DT_DIR, d_reclen=3D32, d_name=3D"linux"}}, 4096) =3D 104
_llseek(3, 3, [3], SEEK_SET)            =3D 0
getdents64(3, {{d_ino=3D258, d_off=3D9223372036854775807, d_type=3DDT_D=
IR, d_reclen=3D32, d_name=3D"linux"}}, 4096) =3D 32
close(3)                                =3D 0
stat64("test", {st_dev=3Dmakedev(0, 19), st_ino=3D257, st_mode=3DS_IFDI=
R|0755, st_nlink=3D1, st_uid=3D0, st_gid=3D0, st_blksize=3D4096, st_blo=
cks=3D0, st_size=3D0, st_atime=3D2008/12/16-21:15:29, st_mtime=3D2008/1=
2/16-21:15:29, st_ctime=3D2008/12/16-21:15:29}) =3D 0
stat64("test", {st_dev=3Dmakedev(0, 19), st_ino=3D257, st_mode=3DS_IFDI=
R|0755, st_nlink=3D1, st_uid=3D0, st_gid=3D0, st_blksize=3D4096, st_blo=
cks=3D0, st_size=3D0, st_atime=3D2008/12/16-21:15:29, st_mtime=3D2008/1=
2/16-21:15:29, st_ctime=3D2008/12/16-21:15:29}) =3D 0
write(2, "est/", 4)                     =3D 4
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  =3D 0


and now, after adding a file to that dir with "touch abcd", for my curi=
ousity this makes "cd l<tab>" work again.

open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) =3D 3
fstat64(3, {st_dev=3Dmakedev(0, 19), st_ino=3D256, st_mode=3DS_IFDIR|05=
55, st_nlink=3D1, st_uid=3D0, st_gid=3D0, st_blksize=3D4096, st_blocks=3D=
8, st_size=3D26, st_atime=3D2008/12/16-21:34:45, st_mtime=3D2008/12/16-=
21:34:44, st_ctime=3D2008/12/16-21:34:44}) =3D 0
getdents64(3, {{d_ino=3D256, d_off=3D2, d_type=3DDT_DIR, d_reclen=3D24,=
 d_name=3D"."} {d_ino=3D256, d_off=3D2, d_type=3DDT_DIR, d_reclen=3D24,=
 d_name=3D".."} {d_ino=3D257, d_off=3D3, d_type=3DDT_DIR, d_reclen=3D24=
, d_name=3D"test"} {d_ino=3D258, d_off=3D17, d_type=3DDT_DIR, d_reclen=3D=
32, d_name=3D"linux"} {d_ino=3D272, d_off=3D9223372036854775807, d_type=
=3DDT_REG, d_reclen=3D24, d_name=3D"abcd"}}, 4096) =3D 128
_llseek(3, 17, [17], SEEK_SET)          =3D 0
getdents64(3, {{d_ino=3D272, d_off=3D9223372036854775807, d_type=3DDT_R=
EG, d_reclen=3D24, d_name=3D"abcd"}}, 4096) =3D 24
close(3)                                =3D 0
stat64("linux", {st_dev=3Dmakedev(0, 19), st_ino=3D258, st_mode=3DS_IFD=
IR|0755, st_nlink=3D1, st_uid=3D0, st_gid=3D0, st_blksize=3D4096, st_bl=
ocks=3D0, st_size=3D0, st_atime=3D2008/12/16-21:15:33, st_mtime=3D2008/=
12/16-21:15:33, st_ctime=3D2008/12/16-21:15:33}) =3D 0
stat64("linux", {st_dev=3Dmakedev(0, 19), st_ino=3D258, st_mode=3DS_IFD=
IR|0755, st_nlink=3D1, st_uid=3D0, st_gid=3D0, st_blksize=3D4096, st_bl=
ocks=3D0, st_size=3D0, st_atime=3D2008/12/16-21:15:33, st_mtime=3D2008/=
12/16-21:15:33, st_ctime=3D2008/12/16-21:15:33}) =3D 0
write(2, "inux/", 5)                    =3D 5
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  =3D 0


regards
roland


_______________________________________________________________________
T=E4glich 1.000.000 Euro gewinnen! Jetzt kostenlos WEB.DE MillionenKlic=
k=20
spielen! https://millionenklick.web.de/?mc=3Dmail@footer.mklick@home

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: weird bash autocomplete issue
@ 2008-12-19  9:15 devzero
  0 siblings, 0 replies; 15+ messages in thread
From: devzero @ 2008-12-19  9:15 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Chris Mason, linux-btrfs

> Sure, would be good to have that fixed. Cc: kasievers@novell.com in
> the bug, and I will move it directly to the right guy. :)

ok, just submitted.

https://bugzilla.novell.com/show_bug.cgi?id=3D460560


regards
roland


> -----Urspr=FCngliche Nachricht-----
> Von: "Kay Sievers" <kay.sievers@vrfy.org>
> Gesendet: 19.12.08 02:27:34
> An: devzero@web.de
> CC: "Chris Mason" <chris.mason@oracle.com>,  "linux-btrfs@vger.kernel=
=2Eorg" <linux-btrfs@vger.kernel.org>
> Betreff: Re: weird bash autocomplete issue


> On Fri, Dec 19, 2008 at 01:59,  <devzero@web.de> wrote:
> >> I see the same issue on x86 32 bit, with the additional __llseek()
> >> between the getdents64(), and the last entry returned by readdir
> >> ignored.
> >
> > confirmed - it`s readdir which assumes 32bit.
> >
> > attached is a sample program which shows the issue on my system.
> >
> > if compiled with -D_FILE_OFFSET_BITS=3D64", the problem goes away.
> >
> > old posting from around 2001:
> >
> >>http://sourceware.org/ml/libc-alpha/2001-01/msg00216.html
> >>
> >>This is why everybody will have to compile programs with
> >>_FILE_OFFSET_BITS=3D64.  Did you ever notice that all GNU programs
> >>already do this?
> >
> > as 32bit systems can use 64bit filesystems, i think btrfs is correc=
t and bash is wrong,
> > as it isn`t LFS aware. i think all 32bit stuff should be LFS aware,=
 nowadays.
> >
> > to be exact, it`s not bash but readline library which comes with ba=
sh.
> > bash configure script correctly checks for _FILE_OFFSET_BITS value,=
 but readline configure script doesn`t.
> > this explains why i could not reproduce the issue when i build bash=
 without readline support.
> >
> > does it make sense to file a ticket at novell bugzilla ?
>=20
> Sure, would be good to have that fixed. Cc: kasievers@novell.com in
> the bug, and I will move it directly to the right guy. :)
>=20
> Thanks,
> Kay
>=20


_______________________________________________________________________
Sensationsangebot verl=E4ngert: WEB.DE FreeDSL - Telefonanschluss + DSL
f=FCr nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=3DOM.AD.AD008K15039B7=
069a

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: weird bash autocomplete issue
@ 2008-12-19  0:59 devzero
  2008-12-19  1:27 ` Kay Sievers
  0 siblings, 1 reply; 15+ messages in thread
From: devzero @ 2008-12-19  0:59 UTC (permalink / raw)
  To: Chris Mason, Kay Sievers; +Cc: linux-btrfs

> I see the same issue on x86 32 bit, with the additional __llseek()
> between the getdents64(), and the last entry returned by readdir
> ignored.

confirmed - it`s readdir which assumes 32bit.

attached is a sample program which shows the issue on my system.

if compiled with -D_FILE_OFFSET_BITS=3D64", the problem goes away.

old posting from around 2001:

>http://sourceware.org/ml/libc-alpha/2001-01/msg00216.html
>
>This is why everybody will have to compile programs with
>_FILE_OFFSET_BITS=3D64.  Did you ever notice that all GNU programs
>already do this?

as 32bit systems can use 64bit filesystems, i think btrfs is correct an=
d bash is wrong,=20
as it isn`t LFS aware. i think all 32bit stuff should be LFS aware, now=
adays.

to be exact, it`s not bash but readline library which comes with bash.
bash configure script correctly checks for _FILE_OFFSET_BITS value, but=
 readline configure script doesn`t.
this explains why i could not reproduce the issue when i build bash wit=
hout readline support.

does it make sense to file a ticket at novell bugzilla ?

regards
roland


linux:/btrfs # ls -ltr
total 13
drwxrwxrwx 1 root root     0 Dec 16 22:44 test
drwxrwxrwx 1 root root  1056 Dec 17 01:10 linux-2.6.27.8-1
drwxr-xr-x 1 root root     0 Dec 17 22:53 abc
drwxr-xr-x 1 root root     0 Dec 19 00:48 bcd
-rw-r--r-- 1 root root   443 Dec 19 01:15 example.c
-rwxr-xr-x 1 root root 10962 Dec 19 01:15 a.out

linux:/btrfs # ./a.out
=2E
=2E.
linux-2.6.27.8-1
test
abc
bcd
example.c
readdir: Value too large for defined data type


regards
roland



#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>

int main( int argc, char *argv[] ) {
    DIR *pDIR;
    struct dirent *pDirEnt;

    pDIR =3D opendir(".");

    pDirEnt =3D readdir( pDIR );

    while ( pDirEnt !=3D NULL ) {
        printf( "%s\n", pDirEnt->d_name );
        pDirEnt =3D readdir( pDIR );
        if (errno) perror("readdir");

    }

    closedir( pDIR );

}
____________________________________________________________________
Psssst! Schon vom neuen WEB.DE MultiMessenger geh=F6rt?=20
Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3D3123

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: weird bash autocomplete issue
@ 2008-12-17 14:40 devzero
  0 siblings, 0 replies; 15+ messages in thread
From: devzero @ 2008-12-17 14:40 UTC (permalink / raw)
  To: Kay Sievers; +Cc: linux-btrfs

> > linux:~ # bash -version
> > GNU bash, version 3.2.39(1)-release (i586-suse-linux-gnu)
> > Copyright (C) 2007 Free Software Foundation, Inc.
>=20
> That is still the same bash, the one you use is a 32bit version. Do
> you run a 32 bit kernel too? I could try that on a 32 bit box then.
>=20
> Thanks,
> Kay
>=20

yes, all 32bit.=20
_______________________________________________________________________
T=E4glich 1.000.000 Euro gewinnen! Jetzt kostenlos WEB.DE MillionenKlic=
k=20
spielen! https://millionenklick.web.de/?mc=3Dmail@footer.mklick@home

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread
* weird bash autocomplete issue
@ 2008-12-16 19:37 Roland
  2008-12-16 19:47 ` Kay Sievers
  0 siblings, 1 reply; 15+ messages in thread
From: Roland @ 2008-12-16 19:37 UTC (permalink / raw)
  To: linux-btrfs

hi,

i have come across a weird autocomplete issue i assume it is related to 
btrfs.

let`s have some dirs:

/non-btrfs-mount
    ./linux
    ./testdir

/brtfs-mount
    ./linux
    ./testdir

now, if i do "cd t<tab>" in /non-btrfs-mount, "t" autocompletes to "testdir"
same for l<tab>inux - bash autocompletes as expected.

now, the weird thing is, that on /btrfs-mount this behaves different.

autocompletion for testdir works, but not for linux dir. weird.

can someone reproduce this ?

i`m on opensuse 11.1 with 2.6.27.8-1-default and latest btrfs-unstable from 
git.

regards
roland 


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

end of thread, other threads:[~2008-12-19  9:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-16 20:46 weird bash autocomplete issue devzero
2008-12-16 21:41 ` Kay Sievers
2008-12-17  2:55   ` Kay Sievers
2008-12-17  8:45     ` Roland
2008-12-17 13:59       ` Kay Sievers
2008-12-17 14:17         ` Chris Mason
2008-12-17 14:46           ` Kay Sievers
2008-12-17 22:15             ` Kay Sievers
2008-12-17 23:58               ` Chris Mason
  -- strict thread matches above, loose matches on Subject: below --
2008-12-19  9:15 devzero
2008-12-19  0:59 devzero
2008-12-19  1:27 ` Kay Sievers
2008-12-17 14:40 devzero
2008-12-16 19:37 Roland
2008-12-16 19:47 ` Kay Sievers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.