* realpath(3) bugs
@ 2012-05-04 11:22 Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA
[not found] ` <201205041122.q44BMDEO002270-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA @ 2012-05-04 11:22 UTC (permalink / raw)
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
For some reason, many of the realpath() manual pages (BSD, Linux) have
words to the following effect:
Solaris may return a relative pathname when the path argument is relative.
I have looked through the Solaris source files and have found no
such bug reported or fixed; the implementation from at least 1997 and
beyond certainly doesn't have this problem and even the older versions
prepend getcwd() or chdir() to dirname and run getcwd() in that
directory.
Solaris does have a system call which may return relative pathnames:
resolvepath(). I believe that that function may have confused earlier
writers of realpath() manual pages and this was later copied without
verifying that fact.
realpath() existed in Solaris 2.0 as it came from SVr4.0 and even at that
time i t returned the full, non-relative path.
Casper Dik (Solaris Engineering)
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread[parent not found: <201205041122.q44BMDEO002270-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org>]
* Re: realpath(3) bugs [not found] ` <201205041122.q44BMDEO002270-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org> @ 2012-05-04 22:54 ` Michael Kerrisk (man-pages) [not found] ` <CAKgNAkgjjKXx_Aw5iF_Phe7c7ixpqtfLSiV6fkTttN5ge4CGww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Michael Kerrisk (man-pages) @ 2012-05-04 22:54 UTC (permalink / raw) To: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, Andries Brouwer Hello Casper, On Fri, May 4, 2012 at 11:22 PM, <Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> wrote: > > > For some reason, many of the realpath() manual pages (BSD, Linux) have > words to the following effect: > > Solaris may return a relative pathname when the path argument is relative. > > I have looked through the Solaris source files and have found no > such bug reported or fixed; the implementation from at least 1997 and > beyond certainly doesn't have this problem and even the older versions > prepend getcwd() or chdir() to dirname and run getcwd() in that > directory. > > Solaris does have a system call which may return relative pathnames: > resolvepath(). I believe that that function may have confused earlier > writers of realpath() manual pages and this was later copied without > verifying that fact. > > realpath() existed in Solaris 2.0 as it came from SVr4.0 and even at that > time i t returned the full, non-relative path. There is unfortunately no indication of how that text came to be in the page. It appears to have been added when Andries rewrote the Linux man page in 1999, so I've CCed Andries on the small chance he may remember something of where the text came from. Given the info you've provided, I've deleted this text from the Linux page (well, commented it out in the source). Thanks for the report. Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAKgNAkgjjKXx_Aw5iF_Phe7c7ixpqtfLSiV6fkTttN5ge4CGww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: realpath(3) bugs [not found] ` <CAKgNAkgjjKXx_Aw5iF_Phe7c7ixpqtfLSiV6fkTttN5ge4CGww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2012-05-05 0:06 ` Andries E. Brouwer 2012-05-05 7:34 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA 0 siblings, 1 reply; 8+ messages in thread From: Andries E. Brouwer @ 2012-05-05 0:06 UTC (permalink / raw) To: Michael Kerrisk (man-pages) Cc: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA, linux-man-u79uwXL29TY76Z2rM5mHXA, Andries Brouwer On Fri, May 4, 2012 at 11:22 PM, <Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> wrote: >> For some reason, many of the realpath() manual pages (BSD, Linux) have >> words to the following effect: >> >> Solaris may return a relative pathname when the path argument is relative. >> >> I have looked through the Solaris source files and have found no >> such bug reported or fixed; the implementation from at least 1997 and >> beyond certainly doesn't have this problem and even the older versions >> prepend getcwd() or chdir() to dirname and run getcwd() in that >> directory. >> >> realpath() existed in Solaris 2.0 as it came from SVr4.0 and even at that >> time i t returned the full, non-relative path. I wrote the Linux man page on 1999-08-24. It was first included in man-pages-1.26. The note about Solaris came from the 4.4BSD-Lite man page realpath.3 (dated 1994-02-16) which says: .Sh CAVEATS This implementation of .Fn realpath differs slightly from the Solaris implementation. The .Bx 4.4 version always returns absolute pathnames, whereas the Solaris implementation will, under certain circumstances, return a relative .Fa resolved_path when given a relative .Fa pathname . I forgot the details. What happens if some of the directories involved are not readable or not searchable? What happens if some parent directory was overmounted so that there is no absolute pathname in the system that refers to the same place as your relative pathname? Andries -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: realpath(3) bugs 2012-05-05 0:06 ` Andries E. Brouwer @ 2012-05-05 7:34 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA [not found] ` <201205050734.q457Y2AC002399-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA @ 2012-05-05 7:34 UTC (permalink / raw) To: Andries E. Brouwer Cc: Michael Kerrisk (man-pages), linux-man-u79uwXL29TY76Z2rM5mHXA >I wrote the Linux man page on 1999-08-24. >It was first included in man-pages-1.26. > >The note about Solaris came from the 4.4BSD-Lite man page realpath.3 >(dated 1994-02-16) which says: Yes, it noticed that it exists in both BSD and Linux manual pages; I asssumed it was copied by one or the other. Yours address was the first I could find to get it remoed. >I forgot the details. What happens if some of the directories involved >are not readable or not searchable? What happens if some parent >directory was overmounted so that there is no absolute pathname >in the system that refers to the same place as your relative pathname? >From my reading from the source code, it would fail if it fails to find the pathname, e.g., whem the pathname desn't exist, getcwd() fails, chdir() fails (the very old implementation uses chdir() to the pathname or its dirname and runs getcwd()) Later implementation use resolvepath() (since 1997) and resolvepath() returns a relative pathname if resolvepat does't find the root) and then combnes the outut with getcwd() removing one component for each ".." in front of the pathname. If either of the calls fail, realpath will fail and if it succeeds i returns a absolute pathname. Casper -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <201205050734.q457Y2AC002399-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org>]
* Re: realpath(3) bugs [not found] ` <201205050734.q457Y2AC002399-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org> @ 2012-05-05 15:50 ` Andries E. Brouwer 2012-05-05 18:10 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA 2012-05-05 18:34 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA 0 siblings, 2 replies; 8+ messages in thread From: Andries E. Brouwer @ 2012-05-05 15:50 UTC (permalink / raw) To: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA Cc: Andries E. Brouwer, Michael Kerrisk (man-pages), linux-man-u79uwXL29TY76Z2rM5mHXA On Sat, May 05, 2012 at 09:34:01AM +0200, Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org wrote: > >The note about Solaris came from the 4.4BSD-Lite man page realpath.3 > >(dated 1994-02-16) which says: > > Yes, it noticed that it exists in both BSD and Linux manual pages; > I asssumed it was copied by one or the other. Yours address was the > first I could find to get it remoed. I am not sure something needs to be removed. One might write "early versions of" when something is no longer true in recent versions. Andries [In case you wonder whether this variation ever existed: I have no old sources, at least not easily accessible, but where some man pages straightforwardly state "The realpath() function derives, from the pathname pointed to by file_name, an absolute pathname that names the same file, whose resolution does not involve ".", "..", or symbolic links." , there are older SunOS man pages that say "realpath() resolves all links, symbolic links, and references to ``.'' and ``..'' in file_name and stores the path in resolved_name. It can handle both relative and absolute path names: * For absolute path names and the relative names whose resolved name cannot be expressed relatively (for example, ../../reldir), it returns the resolved absolute name. * For the other relative path names, it returns the resolved relative name." Such descriptions strongly suggest that the documented version of realpath need not return an absolute pathname in all cases.] -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: realpath(3) bugs 2012-05-05 15:50 ` Andries E. Brouwer @ 2012-05-05 18:10 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA [not found] ` <201205051810.q45IAU9K000837-Og0DlWfCjE/86v54HqmmKFaTQe2KTcn/@public.gmane.org> 2012-05-05 18:34 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA 1 sibling, 1 reply; 8+ messages in thread From: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA @ 2012-05-05 18:10 UTC (permalink / raw) To: Andries E. Brouwer Cc: Michael Kerrisk (man-pages), linux-man-u79uwXL29TY76Z2rM5mHXA >On Sat, May 05, 2012 at 09:34:01AM +0200, Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org wrote: > >> >The note about Solaris came from the 4.4BSD-Lite man page realpath.3 >> >(dated 1994-02-16) which says: >> >> Yes, it noticed that it exists in both BSD and Linux manual pages; >> I asssumed it was copied by one or the other. Yours address was the >> first I could find to get it remoed. > >I am not sure something needs to be removed. One might write >"early versions of" when something is no longer true in recent versions. > >Andries > > >[In case you wonder whether this variation ever existed: >I have no old sources, at least not easily accessible, >but where some man pages straightforwardly state Right; but it certainly doesn't relate to *Solaris* possibly to SunOS 4.x; but not Solaris. >"The realpath() function derives, from the pathname pointed to >by file_name, an absolute pathname that names the same file, >whose resolution does not involve ".", "..", or symbolic links." > >, there are older SunOS man pages that say Which version? The realpath() version in Solaris 2.0 derives from SVr4 and it certainly creates an absolute pathname. >"realpath() resolves all links, symbolic links, and references to ``.'' >and ``..'' in file_name and stores the path in resolved_name. >It can handle both relative and absolute path names: > * For absolute path names and the relative names whose resolved name >cannot be expressed relatively (for example, ../../reldir), it returns >the resolved absolute name. > * For the other relative path names, it returns the resolved relative name." > >Such descriptions strongly suggest that the documented version >of realpath need not return an absolute pathname in all cases.] In SunOS 4.x possibly but not in any Solaris 2.x release; I have access to all of the Slaris 2.x releases. Casper -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <201205051810.q45IAU9K000837-Og0DlWfCjE/86v54HqmmKFaTQe2KTcn/@public.gmane.org>]
* Re: realpath(3) bugs [not found] ` <201205051810.q45IAU9K000837-Og0DlWfCjE/86v54HqmmKFaTQe2KTcn/@public.gmane.org> @ 2012-05-05 22:14 ` Andries E. Brouwer 0 siblings, 0 replies; 8+ messages in thread From: Andries E. Brouwer @ 2012-05-05 22:14 UTC (permalink / raw) To: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA Cc: Andries E. Brouwer, Michael Kerrisk (man-pages), linux-man-u79uwXL29TY76Z2rM5mHXA On Sat, May 05, 2012 at 08:34:50PM +0200, Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org wrote: > I've looked through earlier SunOS versions and I didn't find > it n SunOS 3.5 but I did find it in SunOS 4.1.1. > So if i ever happened in SunOS it may happened in SunOS 4.0. Guy Harris wrote (1992-01-17): : Unfortunately, "realpath()" is *not* present in BSD, as of 4.3-reno; : I think it first showed up in SunOS 4.0, and was then picked up by other : systems, such as System V Release 4. That seems to define the history. SunOS 4.0 -> SVr4 -> Solaris 2.0. Concerning man pages: old man pages (for a derived version, cf. http://osr600doc.sco.com/en/man/html.S-osr5/realpath.S-osr5.html ) document realpath as sometimes returning a relative path. Later man pages leave the old text but prefix it by a new paragraph stating that an absolute path is returned. This yields confusing versions like the SunOS 5.9 one given in http://www.s-gms.ms.edus.si/cgi-bin/man-cgi?realpath+3C . Still later man pages remove all mention of relative paths (or comment it out, as Apple did). Andries -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: realpath(3) bugs 2012-05-05 15:50 ` Andries E. Brouwer 2012-05-05 18:10 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA @ 2012-05-05 18:34 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA 1 sibling, 0 replies; 8+ messages in thread From: Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA @ 2012-05-05 18:34 UTC (permalink / raw) To: Andries E. Brouwer Cc: Michael Kerrisk (man-pages), linux-man-u79uwXL29TY76Z2rM5mHXA >I am not sure something needs to be removed. One might write >"early versions of" when something is no longer true in recent versions. I've looked through earlier SunOS versions and I didn't find it n SunOS 3.5 but I did find it in SunOS 4.1.1. The code simply starts with: if pathname doesn't start with '/' prepend the current working directory. That code looks very much like the earlier SvR4 code; so I think that if the SunOS manual page says that, it was incorrect as the code will either fail or it will return an absolute pathname. (Any error cass the code to return NULL) Just like the current Solaris realpath(3c) manpage incorrectly says that realpath() can change your cwd on error; this cannot happen since Solaris 9 but was not removed) So if i ever happened in SunOS it may happened in SunOS 4.0, so I think it is still not correct to claim that "Solaris" ever didn't return an absolute pathname; the first of Solaris was SunOS 4.1.2 (Solaris 1.0) and that already only returned an absolute pathname. Casper -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-05-05 22:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-04 11:22 realpath(3) bugs Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA
[not found] ` <201205041122.q44BMDEO002270-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org>
2012-05-04 22:54 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAkgjjKXx_Aw5iF_Phe7c7ixpqtfLSiV6fkTttN5ge4CGww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-05 0:06 ` Andries E. Brouwer
2012-05-05 7:34 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA
[not found] ` <201205050734.q457Y2AC002399-Og0DlWfCjE/25RUcvsgne1aTQe2KTcn/@public.gmane.org>
2012-05-05 15:50 ` Andries E. Brouwer
2012-05-05 18:10 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA
[not found] ` <201205051810.q45IAU9K000837-Og0DlWfCjE/86v54HqmmKFaTQe2KTcn/@public.gmane.org>
2012-05-05 22:14 ` Andries E. Brouwer
2012-05-05 18:34 ` Casper.Dik-QHcLZuEGTsvQT0dZR+AlfA
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox