On Sat, Sep 21, 2013 at 3:33 PM, Glenn Fowler <[email protected]> wrote:
>
> On Sat, 21 Sep 2013 08:51:38 +0200 Lionel Cons wrote:
>> On 19 September 2013 18:53, Roland Mainz <[email protected]> wrote:
>> > On Thu, Sep 19, 2013 at 6:08 PM, Glenn Fowler <[email protected]> 
>> > wrote:
>> >>
>> >> can someone post urls for the man pages for
>> >>         readlink(1)
>> >>         realpath(1)
>> >
>> > 1. The relevant references:
>> > The all-in-one manpage for busybox can be found here:
>> > http://busybox.net/downloads/BusyBox.html
>> >
>> > FreeBSD readlink(1):
>> > http://www.freebsd.org/cgi/man.cgi?query=readlink&apropos=0&sektion=1&manpath=FreeBSD+9.1-RELEASE&arch=default&format=html
>> > FreeBSD realpath(1):
>> > http://www.freebsd.org/cgi/man.cgi?query=realpath&apropos=0&sektion=1&manpath=FreeBSD+9.1-RELEASE&arch=default&format=html
>
> both man pages describe the operands as
>         [ path ... ]
>         [ file ... ]
> but only the realpath says what happens if file is omitted (. is used)
> neither say what happens if more than one path/file operand is specified
> readlink annoyingly inverts -q/-v -- diagnostics are off by default -- *what 
> other posix utility does that*
>
> so what does readlink do in silent mode when it is invoked with
>         readlink is-a-symlink is-not-a-symlink is-another-symlink
>
> from the refs roland supplied the gnu readlink and realpath are very close 
> modulo defaults
> mainly readlink with no --canonicalize* options is in "readlink" mode, 
> otherwise "realpath" mode
> and the annoying one: readlink by default suppresses diagnostics
>
> so I need to know what happens on bsd and gnu for readlink and realpath for 
> various combinations of
> 0,1,2,3 path/file operands and within that various combinations of
>         is-a-symlink is-not-a-symlink is-an-existing-path 
> is-not-an-existing-path
> in particular when there are multiple operands and an error occurs does the 
> output have a blank line to mark the errors?
>
> my intention is to provide one implementation of realpath with a union of the
> ast --dirfd=fd + gnu readlink/realpath + bsd readlink/realpath options
> and an additional --readlink option that puts it into "readlink" mode 
> (operand is a symlink, diagnostics suppressed),
> and a note that argv[0]=="*readlink" => --readlink
> this will given us one implementation and one document to manage

Oh for gods sake. Please don't do that. Please keep the readlink(1)
and realpath(1) utilities separate entities, to keep the code simple,
maintainable and instructive. One tool per job, and not a Swiss army
knife catch-all, sink-all and defeat-communism in one go. Think about
later generations of students being forced to study your work and be
happy with it[1] :)

[1] There have been rumors of compulsory hospitalization after people
spend too much time digging for bugs in the GNU coreutils source, so
please ;)

Irek
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to