Discussion:
Bug#941563: binfmtc: Example scripts no longer work
Add Reply
Oliver Schode
2019-10-02 00:40:05 UTC
Reply
Permalink
Package: binfmtc
Version: 0.17-2+b1
Severity: important

Hi,

realcsh.c and realcxxsh.cc are broken, apparently no longer linking
correctly to readline:


/usr/bin/ld: /tmp/ccx5pXpn.o: in function `main':
/usr/bin/realcsh.c:64: undefined reference to `readline'
/usr/bin/ld: /usr/bin/realcsh.c:72: undefined reference to `add_history'
collect2: error: ld returned 1 exit status
binfmtc: Compilation failed for /usr/bin/realcsh.c, see above messages for details


Not sure what's wrong, but it does indeed look like it started with the
last readline upgrade. Both of them worked at least a couple of months
ago.


-- System Information:
Debian Release: bullseye/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)

Versions of packages binfmtc depends on:
ii binfmt-support 2.2.0-2
ii binutils 2.32.51.20190909-1
ii g++ 4:9.2.1-3.1
ii gcc 4:9.2.1-3.1
ii libc6 2.29-2

Versions of packages binfmtc recommends:
ii libreadline-dev 8.0-3

Versions of packages binfmtc suggests:
pn gcj-jdk <none>
pn gfortran <none>
s***@gmail.com
2020-09-03 06:40:02 UTC
Reply
Permalink
Hello,
I am experiencing the same bug in Ubuntu 20.04 (Focal). My binfmtc
version is 0.17-2 and versions of gcc and g++ are :
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0.
Here is output from running realcsh.c :

realcsh.c: In function ‘main’:
realcsh.c:96:7: warning: ignoring return value of ‘asprintf’, declared
with attribute warn_unused_result [-Wunused-result]
96 | asprintf(&tempfilename, "%s/realcshXXXXXX",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97 | getenv("BINFMTCTMPDIR")?:
| ~~~~~~~~~~~~~~~~~~~~~~~~~
98 | getenv("TMPDIR")?:
| ~~~~~~~~~~~~~~~~~~
99 | getenv("TEMPDIR")?:
| ~~~~~~~~~~~~~~~~~~~
100 | "/tmp"
| ~~~~~~
101 | );
| ~
realcsh.c:126:7: warning: ignoring return value of ‘system’, declared
with attribute warn_unused_result [-Wunused-result]
126 | system (tempfilename);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccRfBXnK.o: in function `main':
/usr/bin/realcsh.c:64: undefined reference to `readline'
/usr/bin/ld: /usr/bin/realcsh.c:72: undefined reference to
`add_history'
collect2: error: ld returned 1 exit status
binfmtc: Compilation failed for /usr/bin/realcsh.c, see above messages
for details

Possible fix :
If I set the variable BINFMTC_DEBUG to 1 by
export BINFMTC_DEBUG=1
I can see that binfmtc-interpreter executes :
binfmtc: Execute command-line: gcc -o /tmp/binfmtc0biaup -x c -
lreadline -I/usr/include/readline -O2 -Wall -g "realcsh.c"

This is not right and does not compile if I run the same command on the
terminal (with "realcsh.c" replaced by "/usr/bin/realcsh.c") and also
produces exactly the same error message as running realcsh.c (without
BINFMTC_DEBUG).

The proper order of gcc options, which compiles, is :
gcc -x c -O2 -Wall -g -I/usr/include/readline "/usr/bin/realcsh.c"
-lreadline -o /tmp/binfmtc0biaup
The -lreadline option should be before -o in order for the linking to
work.
Andreas Tille
2025-02-26 15:50:01 UTC
Reply
Permalink
Hi Junichi,

thank you for always working on very nifty packages. Despite I like the
idea of binfmtc I'm a bit worried about this bug report. For me it
looks like the severity should be rather grave to make it RC. I've also
checked popcon of the package[1] was never really high and is decreasing
over the last years.

Thus I wonder whether we should rather remove the package from Debian.

Since your package came up as a candidate for the Bug of the Day[2] I
would happily take over the task to file a RoM bug report if you give me
permission to do so.

Kind regards
Andreas.

[1] https://qa.debian.org/popcon.php?package=binfmtc
[2] https://salsa.debian.org/tille/tiny_qa_tools/-/wikis/Tiny-QA-tasks#bug-of-the-day
--
https://fam-tille.de
Chris Hofstaedtler
2025-02-26 16:10:02 UTC
Reply
Permalink
Post by Andreas Tille
thank you for always working on very nifty packages. Despite I like the
idea of binfmtc I'm a bit worried about this bug report. For me it
looks like the severity should be rather grave to make it RC.
Non-withstanding other reasons for removing this package, I think
_this_ bug makes a very weak argument. If anything, the examples
should not be installed into /usr/bin in the first place.

readline changed in some way, but that's not really relevant for the
features binfmtc promises.

Chris
Junichi Uekawa
2025-02-27 08:50:01 UTC
Reply
Permalink
hi,

On Thu, 27 Feb 2025 01:00:30 +0900,
Post by Chris Hofstaedtler
Post by Andreas Tille
thank you for always working on very nifty packages. Despite I like the
idea of binfmtc I'm a bit worried about this bug report. For me it
looks like the severity should be rather grave to make it RC.
Non-withstanding other reasons for removing this package, I think
_this_ bug makes a very weak argument. If anything, the examples
should not be installed into /usr/bin in the first place.
readline changed in some way, but that's not really relevant for the
features binfmtc promises.
We should really have a automated test for this, but these examples
are toy examples.

I haven't really had the motivation or time to look into binfmtc
though. I don't personally use it anymore.
Andreas Tille
2025-02-27 09:50:01 UTC
Reply
Permalink
Hi Junichi,

thank you for raising your opinion.
Post by Junichi Uekawa
We should really have a automated test for this, but these examples
are toy examples.
I haven't really had the motivation or time to look into binfmtc
though. I don't personally use it anymore.
Which would you consider the best course of action:

[ ] Removal from Debian
[ ] Create a repository on Salsa and do a QA upload

? I'd volunteer to care for both options according to your preference.

Kind regards
Andreas.
--
https://fam-tille.de
Junichi Uekawa
2025-02-28 11:40:02 UTC
Reply
Permalink
On Thu, 27 Feb 2025 18:41:20 +0900,
Post by Andreas Tille
Hi Junichi,
thank you for raising your opinion.
Post by Junichi Uekawa
We should really have a automated test for this, but these examples
are toy examples.
I haven't really had the motivation or time to look into binfmtc
though. I don't personally use it anymore.
[ ] Removal from Debian
[ ] Create a repository on Salsa and do a QA upload
Git repository is
https://github.com/dancerj/binfmtc
copying that around to salsa and doing a QA upload would be nice.
Andreas Tille
2025-02-28 14:20:01 UTC
Reply
Permalink
Hi Junichi,
Post by Junichi Uekawa
Post by Andreas Tille
[ ] Removal from Debian
[x] Create a repository on Salsa and do a QA upload
Git repository is
https://github.com/dancerj/binfmtc
copying that around to salsa and doing a QA upload would be nice.
Thanks a lot for confirming. I started with importing all NMUs,
adding Homepage + watch file at
https://salsa.debian.org/debian/binfmtc

I'll continue in the next couple of days if noone will beat me.

Thanks a lot for all your work
Andreas.
--
https://fam-tille.de
Andreas Tille
2025-03-01 06:30:01 UTC
Reply
Permalink
Hi again,

much to the thanks to наб <***@nabijaczleweli.xyz> this
is uploaded now.

Kind regards
Andreas.
Post by Andreas Tille
Hi Junichi,
Post by Junichi Uekawa
Post by Andreas Tille
[ ] Removal from Debian
[x] Create a repository on Salsa and do a QA upload
Git repository is
https://github.com/dancerj/binfmtc
copying that around to salsa and doing a QA upload would be nice.
Thanks a lot for confirming. I started with importing all NMUs,
adding Homepage + watch file at
https://salsa.debian.org/debian/binfmtc
I'll continue in the next couple of days if noone will beat me.
Thanks a lot for all your work
Andreas.
--
https://fam-tille.de
--
https://fam-tille.de
Junichi Uekawa
2025-02-28 11:30:01 UTC
Reply
Permalink
Seems like adding `-lreadline` after the source code would solve the problem. It seems like gcc started checking for missing symbols at shared library link time (like static libs) whereas before it didn't check.

gcc -lreadline -I /usr/include/readline /usr/bin/realcsh.c # fails
gcc -I /usr/include/readline /usr/bin/realcsh.c -lreadline # succeeds


I think it's a gcc change but I can't find the new gcc option to make
it not do that.
Junichi Uekawa
2025-03-04 10:10:01 UTC
Reply
Permalink
On Fri, 28 Feb 2025 20:21:48 +0900,
Post by Junichi Uekawa
Seems like adding `-lreadline` after the source code would solve the problem. It seems like gcc started checking for missing symbols at shared library link time (like static libs) whereas before it didn't check.
gcc -lreadline -I /usr/include/readline /usr/bin/realcsh.c # fails
gcc -I /usr/include/readline /usr/bin/realcsh.c -lreadline # succeeds
I think it's a gcc change but I can't find the new gcc option to make
it not do that.
The tricky part is that the examples are just a canary and in general
the binfmtc command-line construction needs to take this into
acount. I think the ordering was somewhat hardcoded, and we need to
parse it in such a way so that flags are added in a different
ordering.

Loading...