[Rpm-maint] [rpm-software-management/rpm] rpmspec: Support - as input for reading from stdin (PR #1928)
Panu Matilainen
notifications at github.com
Tue Feb 22 08:32:05 UTC 2022
> I guess the testsuite is messing with stdin but I couldn't figure out how.
I don't think it does, per se, as other similar uses of STDIN_FILENO work fine inside the testsuite. There's something peculiar here though, stracing an attempted test to read foo.spec via stdin shows this:
> 2160157 fcntl(0, F_GETFL) = 0x8000 (flags O_RDONLY|O_LARGEFILE)
2160157 newfstatat(0, "", {st_mode=S_IFREG|0664, st_size=477, ...}, AT_EMPTY_PATH) = 0
2160157 read(0, "%bcond_with bus\n\nSummary: foo\nNa"..., 4096) = 477
2160157 futex(0x7f3aa2dd1b00, FUTEX_WAKE_PRIVATE, 2147483647) = 0
2160157 close(0) = 0
2160157 brk(0xd93000) = 0xd93000
2160157 fcntl(0, F_GETFL) = -1 EBADF (Bad file descriptor)
2160157 write(2, "error: ", 7) = 7
2160157 write(2, "Unable to open -: Bad file descr"..., 38) = 38
So it already reads from the spec and then closes it, wtf? To make it more fun, using another simpler spec succeeds:
```
runroot rpmspec -q --srpm --provides - < ${abs_srcdir}/data/SPECS/hello.spec
```
I think the issue is `fdopen()` - quoting the manual:
> The file descriptor is not dup'ed, and will be closed when the stream created by fdopen() is closed.
So it's you who's messing up with stdin, not the test-suite :smile: The test-suite is just the messenger here.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1928#issuecomment-1047543957
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/1928/c1047543957 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220222/fbbc09c2/attachment.html>
More information about the Rpm-maint
mailing list