Re: [Dorset] Paths relative to a current working directory whose path contains symbolic links

2020-11-10 Thread Ralph Corderoy
Hi Patrick, > > The program can't know which. It shouldn't try and guess but > > instead just pass the argument to open(2), etc. > > That was pretty much my conclusion. It's what wc(1), diff(1), etc., do. The programs which need to handle the ambiguity have options to direct them, e.g. pwd(1),

Re: [Dorset] Paths relative to a current working directory whose path contains symbolic links

2020-11-09 Thread Hamish McIntyre-Bhatty
On 09/11/2020 17:45, Patrick Wigmore wrote: > Thank you so much for that informative response, Ralph. > > So much interesting history! > > On Mon, 09 Nov 2020 15:00:55 +, Ralph Corderoy wrote: >> The program can't know which. It shouldn't try and >> guess but instead just pass the argument to

Re: [Dorset] Paths relative to a current working directory whose path contains symbolic links

2020-11-09 Thread Patrick Wigmore
Thank you so much for that informative response, Ralph. So much interesting history! On Mon, 09 Nov 2020 15:00:55 +, Ralph Corderoy wrote: > The program can't know which. It shouldn't try and > guess but instead just pass the argument to open(2), etc. That was pretty much my conclusion. It

Re: [Dorset] Paths relative to a current working directory whose path contains symbolic links

2020-11-09 Thread Ralph Corderoy
Hi Patrick, Keith's already answered, but here's some background. > Further suppose that, in that path, 'a' is a symbolic link: Symbolic links were an easy hack by Berkeley but they aren't orthogonal to the system they modified and messed up many existing things. They're still messed up

Re: [Dorset] Paths relative to a current working directory whose path contains symbolic links

2020-11-09 Thread Patrick Wigmore
On Mon, 09 Nov 2020 13:46:25 +, Keith Edmunds wrote: > One way (which may or may not be convenient) is to run this from the > shell: > > $ cd $(realpath .) Thanks Keith. A useful tip. In my case, it was necessary to add some quotes, since the path returned by realpath contained some

Re: [Dorset] Paths relative to a current working directory whose path contains symbolic links

2020-11-09 Thread Keith Edmunds
One way (which may or may not be convenient) is to run this from the shell: $ cd $(realpath .) That will set your current directory path to the path with all symlinks resolved. More info here: https://www.tiger-computing.co.uk/linux-tips-finding-real-path/ -- Linux Tips:

[Dorset] Paths relative to a current working directory whose path contains symbolic links

2020-11-09 Thread Patrick Wigmore
Hi all, I was writing a script that took file paths as arguments, and stumbled upon a phenomenon that I wasn't previously aware of, but which I'm guessing is probably quite well known. There is a difference between the way the current working directory is understood by the bash shell and the