bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Reuben Thomas <rrt@sc3d.org>
To: bug-gnulib <bug-gnulib@gnu.org>
Subject: relocatable-prog nits
Date: Sat, 4 Feb 2023 21:58:19 +0000	[thread overview]
Message-ID: <CAOnWdoi2OpOwADTqBe3O=4ABVNW9mCznRTBk2cGWE3sJy89Pmg@mail.gmail.com> (raw)
In-Reply-To: <3039310.PgGeRfN6Q1@nimes>

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

Bruno has been helping me test https://github.com/rrthomas/libpaper on
various systems. (Many thanks, Bruno!)

On Wed, 1 Feb 2023 at 12:39, Bruno Haible <bruno@clisp.org> wrote:

> On GNU/Hurd and Cygwin, I see 9 test failures. Such as
> --- expected-fixed.txt  2023-02-01 03:02:44.000000000 +0100
> +++ default-size-no-default-paper-output-fixed.txt      2023-02-01
> 03:02:44.000000000 +0100
> @@ -1 +1 @@
> -paper: no default paper size is set
> +/home/bruno/libpaper-2.0.5/build/tests/default-size-no-default-paper.9592/home/bruno/bin/paper:
> no default paper size is set
> FAIL default-size-no-default-paper.sh (exit status: 1)
> [snip]
> Apparently the program name includes its path here. Probably because on
> these platforms, the Gnulib --enable-relocatable support leads to the
> creation of 2 installed programs: paper.bin and paper. (The latter is a
> trampoline that invokes paper.bin.)

I would like to make the error messages look nice for the user (rather than
just fixing the tests).

I could use some help here, as I don't understand what's going on!

I use the relocatable-prog gnulib module, and specifically the function
set_program_name_and_installdir(). Looking at its source in
gnulib/lib/progreloc.c, it has code specifically to strip off a ".bin"
suffix. I can't see why this isn't happening on Cygwin (I have code in my
main.c such that _WIN32 is defined, then the name passed to the function is
just "paper", whereas if it isn't, then ".bin" should be stripped out).

Then there's the trampoline, in progreloc.c. This sets argv[0] of the
program it calls to get_full_program_name () plus the .bin suffix. This
seems unfortunate, as progname.c's set_program_name, called by
set_program_name_and_installdir from progreloc.c, deliberately doesn't
remove an absolute path from the start of the executable name.

Should the trampoline not attempt to hide itself, and keep the argv[0] of
the process it execv's the same as its own?

(I'm conscious that Bruno wrote the code in question, but it seemed more
correct to post the question to bug-gnulib than simply reply to him!)


[-- Attachment #2: Type: text/html, Size: 3977 bytes --]

           reply	other threads:[~2023-02-04 21:58 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <3039310.PgGeRfN6Q1@nimes>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOnWdoi2OpOwADTqBe3O=4ABVNW9mCznRTBk2cGWE3sJy89Pmg@mail.gmail.com' \
    --to=rrt@sc3d.org \
    --cc=bug-gnulib@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).