On 08 Feb 2016 10:38, Chet Ramey wrote: > On 2/8/16 10:36 AM, Andreas Schwab wrote: > > Chet Ramey <chet.ra...@case.edu> writes: > >> On 2/8/16 9:59 AM, Andreas Schwab wrote: > >>> Chet Ramey <chet.ra...@case.edu> writes: > >>> > >>>> `cd ..' should fail, since the parent no longer exists, and the pathname > >>>> canonicalization should fail, since there's presumably no longer a valid > >>>> path to reach the current directory. No value for $PWD is correct. > >>> > >>> ${PWD%/*} would be a reasonable value. FWIW, this is what ksh uses in > >>> this case, it doesn't fail. > >> > >> Why would that be more reasonable than anything else? It references a > >> path that doesn't exist. > > > > Sorry, I misread the OP's message. I didn't notice it's about the > > parent's parent, not the parent. > > It's still an unlikely scenario.
fwiw, i see it semi often when dealing with build systems: - use a package manager to build a package - PM creates a fresh new dir tree to build/install - build fails for whatever reason - go into that directory tree (usually multiple levels) - figure out problem - fix it in a diff window - re-run the PM command to build the package in shell in build tree - that shell's active tree is now gone and you get shell-init errors just google "shell-init error retrieving current directory" to see many other people randomly running into it as well. i see it weekly, but i know what's going on, and i build a lot of code. so is it "unlikely" ? i guess in the larger scheme of things compared it might be, but i wouldn't say it's so unlikely that a user would never see it. -mike
signature.asc
Description: Digital signature