Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
|
|
- Not all systems automatically restart signal-interrupted operations,
handle this centrally since its so easy to do. Also related to
RhBug:580974.
|
|
- This reverts commit 4c1f7e335de1724661ce63c53186d161ab71a63f:
various things inside and outside of rpm actually do still depend
on the old behavior, and leak file descriptors otherwise.
As an easy backportable band-aid, revert back to the previous
behavior, to which various callers are tuned to fix the regression
introduced in rpm 4.10.0. The real fix would be something more like
"eliminate fdFree() and make Fclose() honor refcounts".
|
|
- Up to now, if the fd had remaining references fdFree() would return
the supposedly free'd fd back to us, which is unlike anything else
in rpm. Make this consistent with the rest of rpm finally as the
last remaining caller requiring the old semantics is gone from
the codebase (somewhere between 4.9 and 4.10): always return NULL,
as the referenced instance is now gone as far as the caller is concerned.
|
|
- Files can be (much) larger than INT32_MAX, change the return
type to off_t and fix + simplify the calculations. Fixes the other
half of RhBug:790396 and makes ufdCopy() usable for other purposes too.
|
|
|
|
|
|
- bzip2 1.0 is over ten years old by now, anybody still using versions
older than that get what they deserve...
|
|
|
|
|
|
- Remove unnecessary fluff, these are very simple operations
and dont need any temporary variables, re-re-redundant NULL checking
etc, its already done at the caller level.
|
|
|
|
- All the places calling these are already checking for NULL fd,
no point re-re-re-re-re-checking it
|
|
|
|
- There's not a whole lot of point passing our own data structure
around in void pointers and re-re-re-re-re-recasting them to fd's
again all over the place. Just pass the damn fd to begin with.
|
|
- Instead of requiring every io type to remember to update digests
on their own, do it centrally on Fread() and Fwrite().
- This changes the digest calculation on writes slightly: previously
we calculated the digests regardless whether the actual write
succeeded or not, now we do this similarly to reads and only
update the digests on success.
|
|
- Instead of requiring every io type to call stats on their own,
simply call the stat updates from the main functions Fread() etc
|
|
- This used to be relevant for remote io but now its just unused.
- Also remove the "simulate EOF" on NULL fd returns while at it,
these seem simply wrong (considering Fread() and Fwrite() behave
more like read() and write rather than fread() and fwrite())
|
|
|
|
- Merrily returning success on read/write on NULL fd just is not
sane. If something breaks because of this then that something
needs fixing instead...
- Also return code type was mismatching in both, these return
ssize_t not int.
|
|
|
|
|
|
- Fseek() and friends already return -2 for not implemented functions,
this is not needed at all
|
|
- This only ever worked for fpio, for all other types it returns
bogons or crashes and burns.
- Use the file op vectors to find our fflush function instead
of #ifdef/#endif if/else/ifelse jungle.
- Notably fdio and ufdio do not have a fflush() equivalent because
they dont need one. Use a dummy function to always return success to
differentiate from -2 aka "not supported by this io type"
|
|
- The whole thing is extremely hacky and failing to properly take
fundamental differences in eg fread() and read() semantics into
account (the whole rpmio fd is confused over this: Fread() claims
to be fread() clone but reads behave with read() semantics
and we dont provide feof() equivalent etc), special cased all over
the io code when vectors exist for this purpose etc (not that fpio
is the only offender in that regard)... RIP. Nothing should miss
this but if we'd ever want to add it back, it'd better be done
right at least.
- This COULD silently break somebody's code if they rely on the broken
special case semantics of fpio mode, but most likely rpm itself
was the only thing using fpio (and relying on the behavior) and
even then, mostly only to get a FILE stream pointer out of it.
Now we'll just silently return a fdio descriptor, as we do for any
unrecognized io mode... (another sigh)
|
|
- Unlike bz2 and xz/lz, zlib compression is not tracked by any rpmlib
feature and is part of the original package format really, zlib
simply must be always present.
|
|
|
|
- If opened by path, we obviously want to use that. Otherwise
generate a description lazily on first Fdescr() call: on Linux
we can grab something relatively meaningful by looking up from /proc
(this is why we want to be lazy here...). If that's not available
or fails, just generate a string on the current fdno. Actual
paths are returned as is, other descriptions are bracketed,
(eg "[mumble 123]").
- This makes it possible to give more meaningful error messages in
places where we only get an fd from somebody (related to RhBug:522160)
|
|
- Nobody should be able to create file descriptors which are not
attached to a file/descriptor of some kind, the only sane
fd constructors are Fopen(), Fdopen() and fdDup().
- The same applies to fdFree() but its a bit more complicated,
punting that till later...
|
|
|
|
|
|
- it is to be removed in the next soname bump
|
|
|
|
- While its use would seem kinda obvious here, in rpm context this
information often comes from header tags which are plain integers
and would require conversion/casting to the enum. What matters is
the integral value, not it being actual enum.
|
|
|
|
- This matches ffread() and read() much better, avoiding pile of casts.
- By some stroke of genious, glibc cookie interfaces disagree with the
other file stream protos by using char * for buf. Argh. Add explicit
cast for the schizophrenia.
|
|
|
|
- Commit 05b2d979e8097d648f91c773f2535a1f6013cb79 caused the
_USE_LIBIO test in rpmio.c to always fail as <stdio.h> wasn't included
yet at the time of the check, causing silent fallback to not
using libio even if actually available. Which in turn revealed
funky other little bugs, addressed in commits
d960e8c18764f7206ad723963f407e960dfb8ad9 and
be3c34dd15814d70a410b6fd646a2be7de14a1b5. Ptooey.
|
|
- these have been unused since rpm 4.6.0, and can be implemented
without access to rpmio internals too if somebody cares...
|
|
- instead of blowing up with asserts, return error codes / NULLs
|
|
|
|
- blowing up with an assert failure deep inside io "library" is not
a very friendly thing to do...
|
|
- the rpmio API always had this goo, should've gotten rid of it
back in commit dbdbe8010cd944f026a5a4e5d071eb31d29d81c4 but .. oh well
|
|
|
|
- move the includes out of system.h, not commonly needed
- <poll.h> is conditional as we actually provide a fallback through select(),
but for <sys/select.h> missing there's no fallback so doesn't make
much sense to test for (and both poll.h and sys/select.h are posix anyway...)
|
|
- revert part of b0d1038190be5cb4b45e2c2c7c84ee7022164ba2 which broke
the split-personality lzdio/xzdio
|
|
- also differentiate between lzdio and xzdio here
|
|
- we're only dealing with local files once fd is opened
|
|
|
|
- we dont do network IO anymore so ufdio only differs from fdio by
downloading the file on open if necessary, after that it's just fdio
|