bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* relocatable-prog nits
       [not found] ` <3039310.PgGeRfN6Q1@nimes>
@ 2023-02-04 21:58   ` Reuben Thomas
  0 siblings, 0 replies; only message in thread
From: Reuben Thomas @ 2023-02-04 21:58 UTC (permalink / raw)
  To: bug-gnulib

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-04 21:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAOnWdohtMhwR12cdv8D5yXgPscfHmU64d0K7SFT=x41Nfx6XhA@mail.gmail.com>
     [not found] ` <3039310.PgGeRfN6Q1@nimes>
2023-02-04 21:58   ` relocatable-prog nits Reuben Thomas

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).