Re: shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

2014-02-28 Thread zeazas
On Wednesday, December 4, 2013 7:03:40 AM UTC-8, allan...@gmail.com wrote:
> On Thursday, July 17, 2008 11:42:57 PM UTC-4, Chet Ramey wrote:
> 
> > LynnOS wrote:
> 
> > > Thanks ,but after I export PWD,the problem doesn't go
> 
> > 
> 
> > As I explained previously, this is not a bash problem.  This is a
> 
> > problem with file permissions in the current working directory.
> 
> > 
> 
> > 
> 
> > Chet
> 
> > -- 
> 
> > ``The lyf so short, the craft so long to lerne.'' - Chaucer
> 
> > 
> 
> > Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
> 
> 
> 
> I just saw this message upon logging in from OSX Lion to our Centos 5.5 and 
> was starting to look at remote permissions.  Before I started to mess with 
> things I tried from a freshly started console; no problem there.   So I 
> logged out of the remote machine, changed to my home directory (simply typing 
> "cd") and tried again.  No issue. 
> 
> 
> 
> I think I was in a local directory that was removed and recreated or 
> something odd.
> 
> 
> 
> So FWIW.

Ditto on that. I was in a directory that I had previously deleted and 
recreated. When I moved off and launched SSH from another directory. Error on 
remote host disappeared. Both hosts CentOS 6.x


Latest fix for DEBUG causes pipes to fail when used with trap and an interactive shell

2014-02-28 Thread Moe Tunes

From: pnewm
To: bug-bash@gnu.org
Subject: Latest fix for DEBUG makes pipes not work when trap is used

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib 
-D_FORTIFY_SOURCE=2 -march=i686 -mtune=generic -O2 -pipe 
-fstack-protector --param=ssp-buffer-size=4 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' 
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux lappy 3.13.5-1-ARCH #1 SMP PREEMPT Sun Feb 23 
00:10:07 CET 2014 i686 GNU/Linux

Machine Type: i686-pc-linux-gnu

Bash Version: 4.3
Patch Level: 0
Release Status: release

Description:
Pipes stop working in this version when DEBUG is used with trap in 
an interactive shell


Repeat-By:
 pgas | # bash -c 'trap : DEBUG;echo foo | grep -v foo';echo OK
 shbot | pgas: OK
 pgas | # bash -ci 'trap : DEBUG;echo foo | grep -v foo';echo OK
 shbot | pgas: no output within the time limit
 pgas | this is not ok
 pgas | # bash -c 'echo $BASH_VERSION'
 shbot | pgas: 4.3.0(3)-release




error message when rmail isn't installed

2014-02-28 Thread Moe Tunes
When rmail isn't installed, bashbug makes a dead.bashbug file and prints 
an error message saying rmail isn't installed. That error message could 
include this mailing list address to make error reporting easier instead 
of the end user having to search for somewhere to post it.




Re: Latest fix for DEBUG causes pipes to fail when used with trap and an interactive shell

2014-02-28 Thread Chet Ramey
On 2/28/14 2:48 AM, Moe Tunes wrote:

> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 4.3
> Patch Level: 0
> Release Status: release
> 
> Description:
> Pipes stop working in this version when DEBUG is used with trap in an
> interactive shell
> 
> Repeat-By:
>  pgas | # bash -c 'trap : DEBUG;echo foo | grep -v foo';echo OK
>  shbot | pgas: OK
>  pgas | # bash -ci 'trap : DEBUG;echo foo | grep -v foo';echo OK
>  shbot | pgas: no output within the time limit
>  pgas | this is not ok
>  pgas | # bash -c 'echo $BASH_VERSION'
>  shbot | pgas: 4.3.0(3)-release

Thanks for the report.  This appears to be a Linux-specific problem related
to job control.  It doesn't happen on Mac OS X, Solaris, or FreeBSD, and
using -m instead of -i causes it as well.  I'll take a look.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: error message when rmail isn't installed

2014-02-28 Thread Chet Ramey
On 2/28/14 7:36 AM, Moe Tunes wrote:
> When rmail isn't installed, bashbug makes a dead.bashbug file and prints an
> error message saying rmail isn't installed. That error message could
> include this mailing list address to make error reporting easier instead of
> the end user having to search for somewhere to post it.

That's true, it would be a marginal improvement.  However, the last thing
that happens before bashbug tries to email the bug report is that it asks
the user whether he wants to send it to the error reporting email address,
so I'm not sure it's fair to say the script makes the user search.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Latest fix for DEBUG causes pipes to fail when used with trap and an interactive shell

2014-02-28 Thread Chet Ramey
On 2/28/14 2:48 AM, Moe Tunes wrote:

> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 4.3
> Patch Level: 0
> Release Status: release
> 
> Description:
> Pipes stop working in this version when DEBUG is used with trap in an
> interactive shell

It turns out that this is Linux-specific only to the extent that Linux
requires process group synchronization.  One of the changes to trap
handling added a level of saving state that was redundant in the case of
the DEBUG trap, and that broke this synchronization.  I've attached a
patch that fixes the problem.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.3/trap.c	2014-02-05 10:03:21.0 -0500
--- trap.c	2014-02-28 09:51:43.0 -0500
***
*** 921,925 
  
  #if defined (JOB_CONTROL)
!   save_pipeline (1);	/* XXX only provides one save level */
  #endif
  
--- 921,926 
  
  #if defined (JOB_CONTROL)
!   if (sig != DEBUG_TRAP)	/* run_debug_trap does this */
! 	save_pipeline (1);	/* XXX only provides one save level */
  #endif
  
***
*** 941,945 
  
  #if defined (JOB_CONTROL)
!   restore_pipeline (1);
  #endif
  
--- 942,947 
  
  #if defined (JOB_CONTROL)
!   if (sig != DEBUG_TRAP)	/* run_debug_trap does this */
! 	restore_pipeline (1);
  #endif
  


Parent shell gets stopped when a child shell is created with job control but not interactive (bash -mc)

2014-02-28 Thread Eduardo A . Bustamante López
This works fine:

dualbus@debian:~$ ~/local/bin/bash -s <<< 'for i in . .; do (~/local/bin/bash 
-mic ": & wait") ; done'
[1] 1629
[1]+  Done:
[1] 1631
[1]+  Done:

-
This does not:

dualbus@debian:~$ ~/local/bin/bash -s <<< 'for i in . .; do (~/local/bin/bash 
-mc ": & wait") ; done'
[1]+  Done:

[1]+  Stopped ~/local/bin/bash -s <<< 'for i in . .; do 
(~/local/bin/bash -mc ": & wait") ; done'


-
Here's my OS and bash information (bash is
2e4d3851f76a94dfc21af046e0dfd84b954b0f50, from devel)

dualbus@debian:~$ cat /etc/debian_version 
7.3
dualbus@debian:~$ uname -a
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
dualbus@debian:~$ ~/local/bin/bash --version
GNU bash, version 4.3.0(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


-
Here's a sample output from strace when running this (I removed lots
of lines, didn't want to flood the list):


strace -fo bash-mc.log ~/local/bin/bash -s <<< 'for i in . .; do 
(~/local/bin/bash -mc ": & wait") ; done'

29747 execve("/home/dualbus/local/bin/bash", ["/home/dualbus/local/bin/bash", 
"-s"], [/* 24 vars */]) = 0
29747 brk(0)= 0x149c000
29747 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
[...] 1st child
29747 clone(child_stack=0, 
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x7f58bff209d0) = 29748
29747 rt_sigprocmask(SIG_SETMASK, [],  
29748 rt_sigprocmask(SIG_SETMASK, [],  
29747 <... rt_sigprocmask resumed> NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD],  
29748 <... rt_sigprocmask resumed> NULL, 8) = 0
29748 rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},  

29747 <... rt_sigprocmask resumed> [], 8) = 0
29748 <... rt_sigaction resumed> {SIG_DFL, [], 0}, 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [],  
29748 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},  

29747 <... rt_sigprocmask resumed> NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD],  
[...] lots of stuff
29748 open("/home/dualbus/local/share/locale/en_US/LC_MESSAGES/bash.mo", 
O_RDONLY) = -1 ENOENT (No such file or directory)
29748 open("/home/dualbus/local/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY) 
= -1 ENOENT (No such file or directory)
29748 write(2, "[1]+  Done:\n", 32) = 32
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 --- SIGCHLD (Child exited) @ 0 (0) ---
29748 wait4(-1, 0x7fff8fdcad80, WNOHANG|WSTOPPED|WCONTINUED, NULL) = -1 ECHILD 
(No child processes)
29748 rt_sigreturn(0x)  = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 setpgid(0, 29746) = 0
29748 exit_group(0) = ?
29747 <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 
29748
29747 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 
{0x460380, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 --- SIGCHLD (Child exited) @ 0 (0) ---
29747 wait4(-1, 0x7870cd80, WNOHANG, NULL) = -1 ECHILD (No child processes)
29747 rt_sigreturn(0x)  = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
29747 clone(child_stack=0, 
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x7f58bff209d0) = 29750
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29747 rt_sigaction(SIGINT, {0x460380, [], SA_RESTORER, 0x7f58bf5914f0}, 
{SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29747 wait4(-1,  
29750 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29750 rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 
{SIG_DFL, [], 0}, 8) = 0
29750 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 
{SIG_DFL, [], 0}, 8) = 0
29750 rt_sigaction(SIGTTOU, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 
{SIG_DFL, [], 0}, 8) = 0
29750 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER,

`test -R' not working

2014-02-28 Thread NBaH

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Rompilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/home/nbah/share/locale' 
-DPACKAGE='bash'

+-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux diocletien 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 
x86_64 GNU/Linux

Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 0
Release Status: release

Description:

$ var="foo bar"
$ declare -n nameref=var
$ echo "${!nameref} = $nameref"
var = foo bar
$ test -R nameref && echo ok || echo ko
bash: test: -R: unary operator expected
ko


Repeat-By:

$ test -R "nameref" && echo ok || echo ko
bash: test: -R: unary operator expected
ko



I hope I don't miss anything.

TIA


Re: `test -R' not working

2014-02-28 Thread Chet Ramey
On 2/28/14, 4:50 PM, NBaH wrote:

> Bash Version: 4.3
> Patch Level: 0
> Release Status: release
> 
> Description:
> 
> $ var="foo bar"
> $ declare -n nameref=var
> $ echo "${!nameref} = $nameref"
> var = foo bar
> $ test -R nameref && echo ok || echo ko
> bash: test: -R: unary operator expected
> ko

Thanks for the report.  A line got dropped from a merge back during
development.  I've attached a patch that fixes this and one other problem
with -R.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.3/test.c	2014-02-04 16:52:58.0 -0500
--- test.c	2014-02-28 21:22:44.0 -0500
***
*** 647,652 
  
  case 'R':
!   v = find_variable (arg);
!   return (v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v) ? TRUE : FALSE);
  }
  
--- 647,652 
  
  case 'R':
!   v = find_variable_noref (arg);
!   return ((v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v)) ? TRUE : FALSE);
  }
  
***
*** 724,727 
--- 724,728 
  case 'u': case 'v': case 'w': case 'x': case 'z':
  case 'G': case 'L': case 'O': case 'S': case 'N':
+ case 'R':
return (1);
  }