Probably should be linked to https://bugs.gentoo.org/show_bug.cgi?id=430702 * Package: app-misc/fdupes-1.51 * Repository: gentoo * Maintainer: shell-tools@gentoo.org * USE: arm elibc_musl kernel_linux userland_GNU * FEATURES: preserve-libs sandbox userpriv usersandbox >>> Unpacking source... >>> Unpacking fdupes-1.51.tar.gz to /var/tmp/portage/app-misc/fdupes-1.51/work >>> Source unpacked in /var/tmp/portage/app-misc/fdupes-1.51/work >>> Preparing source in /var/tmp/portage/app-misc/fdupes-1.51/work/fdupes-1.51 ... * Applying fdupes-1.51-makefile.patch ... [ ok ] * Applying fdupes-1.50_pre2-compare-file.patch ... [ ok ] * Applying fdupes-1.50_pre2-typo.patch ... [ ok ] >>> Source prepared. >>> Configuring source in /var/tmp/portage/app-misc/fdupes-1.51/work/fdupes-1.51 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/app-misc/fdupes-1.51/work/fdupes-1.51 ... make -j30 CC=armv7a-hardfloat-linux-musleabi-gcc armv7a-hardfloat-linux-musleabi-gcc -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -Wall -I. -DVERSION=\"1.51\" -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -c -o fdupes.o fdupes.c armv7a-hardfloat-linux-musleabi-gcc -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -Wall -I. -DVERSION=\"1.51\" -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -c -o md5/md5.o md5/md5.c fdupes.c: In function ‘main’: fdupes.c:1172:13: error: assignment of read-only variable ‘stdin’ stdin = freopen("/dev/tty", "r", stdin); ^ <builtin>: recipe for target 'fdupes.o' failed make: *** [fdupes.o] Error 1 make: *** Waiting for unfinished jobs.... * ERROR: app-misc/fdupes-1.51::gentoo failed (compile phase): * emake failed * * If you need support, post the output of `emerge --info '=app-misc/fdupes-1.51::gentoo'`, * the complete build log and the output of `emerge -pqv '=app-misc/fdupes-1.51::gentoo'`. * The complete build log is located at '/var/tmp/portage/app-misc/fdupes-1.51/temp/build.log.gz'. * The ebuild environment file is located at '/var/tmp/portage/app-misc/fdupes-1.51/temp/environment'. * Working directory: '/var/tmp/portage/app-misc/fdupes-1.51/work/fdupes-1.51' * S: '/var/tmp/portage/app-misc/fdupes-1.51/work/fdupes-1.51'
(In reply to Michael Jones from comment #0) > fdupes.c: In function ‘main’: > fdupes.c:1172:13: error: assignment of read-only variable ‘stdin’ > stdin = freopen("/dev/tty", "r", stdin); > ^ I'm going to ask Rich about this one, or look directly at the POSIX standards because musl intentionally makes stdin read-only. I don't understand why some programs do this instead of using dup2() or similar.
(In reply to Anthony Basile from comment #1) > (In reply to Michael Jones from comment #0) > > > fdupes.c: In function ‘main’: > > fdupes.c:1172:13: error: assignment of read-only variable ‘stdin’ > > stdin = freopen("/dev/tty", "r", stdin); > > ^ > > I'm going to ask Rich about this one, or look directly at the POSIX > standards because musl intentionally makes stdin read-only. I don't > understand why some programs do this instead of using dup2() or similar. Actually it should be as easy as just dropping `stdin =`. This at least works for stdout as in this little program: #include <stdio.h> int main() { freopen("zzz.txt", "w", stdout); printf("hi\n"); } So I'm not sure why people do stdin = freopen(..);
It's not POSIX related, just plain C. stdin is specified as a macro that expands to an expression (think rvalue) of type FILE *. It need not even be an lvalue, much less one for which assignment is possible. Indeed just dropping the assignment is fine too. freopen only has two possible return values. On success it returns the same FILE * you passed into it. On failure it returns 0 (and the FILE * you passed in has been closed, so there's no way to recover and you probably need to exit immediately).
Its in the overlay, I'm going to see about getting a patch upstream.
Actually Felix already got a patch upstream https://github.com/adrianlopezroche/fdupes/commit/fe2d8334bfa28ff05fa1a2ffe8555a19b41be0ea but its a bit stale with https://github.com/adrianlopezroche/fdupes/commit/03abad92b65b3d7174349ae2cbd08177afec1b79 Both of those patches nail the issue correctly. @darkside, heroxbd, jlec, monsieurp, zlg is it okay if I back port those two patches?
Sure, go ahead!
Looks good to me.
done