[2016-09-17 11:45] Philipp Takacs <phil...@bureaucracy.de>
>
> part       text/plain                1172
> [2016-09-16 15:22] Dmitry Bogatov <kact...@gnu.org>
> >
> > part       text/plain                1232
> >
> >  * avoid bogus Attach header, containing directory of
> >    file being attached
> Claim down explain the bug.

Sure. See this typescript (note two Attach headers):


        Script started on Sun 18 Sep 2016 10:16:00 AM MSK
        $ cat $(mhpath +drafts c)
        To:
        Cc:
        Fcc: +sent
        Subject:
        X-GPG: 54B7F00D
        Sign: yes
        Enc: yes
        --------
        $ touch /tmp/foo
        $ ./uip/whatnow2.sh  /tmp/foo
        $ cat $(mhpath +drafts c)
        To:
        Cc:
        Fcc: +sent
        Subject:
        X-GPG: 54B7F00D
        Sign: yes
        Enc: yes
        Attach: /tmp/foo
        Attach: /home/kaction/devel/alioth/mmh/mmh-git
        --------
        $ exit

> If you mean that symlinks arn't followed, this is expected.
>
> > Another fact is that there is no
> >     `readlink` utility in POSIX-2008. So questions are:
> >
> >      * Are there any worthy systems, which are still in interactive use,
> >        and are lacking `readlink' utility?
>
> Any System implementing POSIX.

According to online POSIX specification[0], there is `readlink(2)' (C
function) in POSIX, but not `readlink(1)'.

In meantime, there is `realpath(2)' in POSIX, which resolves all
symlinks and `..', returning absolute filepath.  But in same spirit,
there is no `realpath' utility in POSIX. According to this [1] thread,
which compares different implementations of `readlink' and `realpath'.

Implication is that `realpath' *without* options is rather portable between
flavors of BSD and GNU/Linux.

In summary, issue is following:

 - On my system current implementation of `whatnow2' adds extra
   unrelated 'Attach:' header with 'whatnow2 attach' command.

 - Problem can be solved by replacing `get_realpath' function
   with `realpath' program.

 - Solution, proposed in previous point implies that symlinks are
   resolved. Current implementation does not. Is it significant?

Suggestions? Opinions?

[0] http://pubs.opengroup.org/onlinepubs/9699919799/mindex.html
[1] 
https://unix.stackexchange.com/questions/136494/whats-the-difference-between-realpath-and-readlink-f

Reply via email to