From: Javi Barroso on
Hi,

I'm wondering with this (I'm with bash 4.1.5(1)-release):

machine:~$ mkdir prueba
machine:~$ cd prueba
machine:~/prueba$ rmdir ~/prueba
machine:~/prueba$ su
Contraseña:
shell-init: error al obtener el directorio actual: getcwd: no se puede
acceder a los directorios padre: No existe el fichero o el directorio
machine:/home/user/prueba# cd ..
chdir: error al obtener el directorio actual: getcwd: no se puede
acceder a los directorios padre: No existe el fichero o el directorio
machine:..# cd ..
machine:../..# cd ..
machine:../../..# cd ..
machine:../../../..# cd ..
machine:../../../../..# ls
bin cdrom etc initrd initrd.img.old lost+found mnt proc
sbin srv tmp var vmlinuz.old
boot dev home initrd.img lib media opt root selinux
sys usr vmlinuz
machine:../../../../..# cd ..
machine:../../../../../..#

Is it a known issue or only happens in my computer?

Thank you!
From: Janis Papanagnou on
Javi Barroso schrieb:
> Hi,
>
> I'm wondering with this (I'm with bash 4.1.5(1)-release):
>
> machine:~$ mkdir prueba
> machine:~$ cd prueba
> machine:~/prueba$ rmdir ~/prueba
> machine:~/prueba$ su
> Contrase�a:
> shell-init: error al obtener el directorio actual: getcwd: no se puede
> acceder a los directorios padre: No existe el fichero o el directorio
> machine:/home/user/prueba# cd ..
> chdir: error al obtener el directorio actual: getcwd: no se puede
> acceder a los directorios padre: No existe el fichero o el directorio
> machine:..# cd ..
> machine:../..# cd ..
> machine:../../..# cd ..
> machine:../../../..# cd ..
> machine:../../../../..# ls
> bin cdrom etc initrd initrd.img.old lost+found mnt proc
> sbin srv tmp var vmlinuz.old
> boot dev home initrd.img lib media opt root selinux
> sys usr vmlinuz
> machine:../../../../..# cd ..
> machine:../../../../../..#
>
> Is it a known issue or only happens in my computer?
>
> Thank you!

It would help if you provide any error messages in English.

If switching user to 'root' gives an error you may inspect /etc/passwd
and check the home directory defined for root.

WRT your "../../../../../.." prompt have a look into your ~/.profile,
in the file /etc/profile, or any additional file that is sourced/loaded
from those two files. Apparently your PS1 prompt has been badly defined.

Janis
From: Javi Barroso on
On Jun 10, 11:53 am, Janis Papanagnou <janis_papanag...(a)hotmail.com>
wrote:
> Javi Barroso schrieb:
>
>
>
> > Hi,
>
> > I'm wondering with this (I'm with bash 4.1.5(1)-release):
>
> > machine:~$ mkdir prueba
> > machine:~$ cd prueba
> > machine:~/prueba$ rmdir ~/prueba
> > machine:~/prueba$ su
> > Contrase a:
> > shell-init: error al obtener el directorio actual: getcwd: no se puede
> > acceder a los directorios padre: No existe el fichero o el directorio
> > machine:/home/user/prueba# cd ..
> > chdir: error al obtener el directorio actual: getcwd: no se puede
> > acceder a los directorios padre: No existe el fichero o el directorio
> > machine:..# cd ..
> > machine:../..# cd ..
> > machine:../../..# cd ..
> > machine:../../../..# cd ..
> > machine:../../../../..# ls
> > bin   cdrom  etc   initrd      initrd.img.old  lost+found  mnt     proc
> > sbin     srv  tmp  var       vmlinuz.old
> > boot  dev    home  initrd.img  lib        media       opt  root  selinux
> > sys  usr  vmlinuz
> > machine:../../../../..# cd ..
> > machine:../../../../../..#
>
> > Is it a known issue or only happens in my computer?
>
> > Thank you!
>
> It would help if you provide any error messages in English.
Ok, I'm sending it again
>
> If switching user to 'root' gives an error you may inspect /etc/passwd
> and check the home directory defined for root.
Error is "error retrieving current directory" because I deleted it
before invoke su

>
> WRT your "../../../../../.." prompt have a look into your ~/.profile,
> in the file /etc/profile, or any additional file that is sourced/loaded
> from those two files. Apparently your PS1 prompt has been badly defined.

I repited commands with PS1 to debian default:
machine:~$ echo $PS1
${debian_chroot:+($debian_chroot)}\u@\h:\w\$
machine:~$ mkdir test
machine:~$ cd test
machine:~/test$ rmdir ~/test
machine:~/test$ su
Contraseña:
shell-init: error retrieving current directory: getcwd: cannot access
parent directories: No such file or directory
machine:/home/javi/test# cd ..
chdir: error retrieving current directory: getcwd: cannot access
parent directories: No such file or directory
machine:..# cd ..
machine:../..# echo $PS1
\h:\w\$
machine:../..# cd ..
machine:../../..#

Which other environment settings could I setted to such behaviour ?
How can I 'su' "with a empty (sane) environment" without having to
remove my .bash* .profile files?

Thank you very much
From: Jon LaBadie on
Javi Barroso wrote:
> On Jun 10, 11:53 am, Janis Papanagnou <janis_papanag...(a)hotmail.com>
> wrote:
>> Javi Barroso schrieb:
>>
>>
>>
>>> Hi,
>>> I'm wondering with this (I'm with bash 4.1.5(1)-release):
>>> machine:~$ mkdir prueba
>>> machine:~$ cd prueba
>>> machine:~/prueba$ rmdir ~/prueba
>>> machine:~/prueba$ su
>>> Contrase a:
>>> shell-init: error al obtener el directorio actual: getcwd: no se puede
>>> acceder a los directorios padre: No existe el fichero o el directorio
>>> machine:/home/user/prueba# cd ..
>>> chdir: error al obtener el directorio actual: getcwd: no se puede
>>> acceder a los directorios padre: No existe el fichero o el directorio
>>> machine:..# cd ..
>>> machine:../..# cd ..
>>> machine:../../..# cd ..
>>> machine:../../../..# cd ..
>>> machine:../../../../..# ls
>>> bin cdrom etc initrd initrd.img.old lost+found mnt proc
>>> sbin srv tmp var vmlinuz.old
>>> boot dev home initrd.img lib media opt root selinux
>>> sys usr vmlinuz
>>> machine:../../../../..# cd ..
>>> machine:../../../../../..#
>>> Is it a known issue or only happens in my computer?
>>> Thank you!
>> It would help if you provide any error messages in English.
> Ok, I'm sending it again
>> If switching user to 'root' gives an error you may inspect /etc/passwd
>> and check the home directory defined for root.
> Error is "error retrieving current directory" because I deleted it
> before invoke su
>
Then change directory to a known good directory using a full pathname.

cd /tmp


From: Javi Barroso on
On Jun 10, 1:46 pm, Jon LaBadie <jlaba...(a)aXcXm.org> wrote:
> Javi Barroso wrote:
> > On Jun 10, 11:53 am, Janis Papanagnou <janis_papanag...(a)hotmail.com>
> > wrote:
> >> Javi Barroso schrieb:
>
> >>> Hi,
> >>> I'm wondering with this (I'm with bash 4.1.5(1)-release):
> >>> machine:~$ mkdir prueba
> >>> machine:~$ cd prueba
> >>> machine:~/prueba$ rmdir ~/prueba
> >>> machine:~/prueba$ su
> >>> Contrase a:
> >>> shell-init: error al obtener el directorio actual: getcwd: no se puede
> >>> acceder a los directorios padre: No existe el fichero o el directorio
> >>> machine:/home/user/prueba# cd ..
> >>> chdir: error al obtener el directorio actual: getcwd: no se puede
> >>> acceder a los directorios padre: No existe el fichero o el directorio
> >>> machine:..# cd ..
> >>> machine:../..# cd ..
> >>> machine:../../..# cd ..
> >>> machine:../../../..# cd ..
> >>> machine:../../../../..# ls
> >>> bin   cdrom  etc   initrd      initrd.img.old  lost+found  mnt     proc
> >>> sbin     srv  tmp  var       vmlinuz.old
> >>> boot  dev    home  initrd.img  lib        media       opt  root  selinux
> >>> sys  usr  vmlinuz
> >>> machine:../../../../..# cd ..
> >>> machine:../../../../../..#
> >>> Is it a known issue or only happens in my computer?
> >>> Thank you!
> >> It would help if you provide any error messages in English.
> > Ok, I'm sending it again
> >> If switching user to 'root' gives an error you may inspect /etc/passwd
> >> and check the home directory defined for root.
> > Error is "error retrieving current directory" because I deleted it
> > before invoke su
>
> Then change directory to a known good directory using a full pathname.
>
>     cd /tmp

I know but I would like to know if that is a bash bug (so should I
report it?) or not (because it is already known)

Thanks