tools/librpm-tizen.git
13 years agoAbort depgen output reading on EOF, not child exiting
Panu Matilainen [Wed, 8 Jun 2011 07:01:14 +0000 (10:01 +0300)]
Abort depgen output reading on EOF, not child exiting
- There could, at least in theory, still be data to read after
  we receive SIGCHLD. Stop the loop on EOF on read instead.
  Thanks to Michael Schroeder for pointing this out.

13 years agoReturn explicit NULL from dbiFreeIndexSet()
Panu Matilainen [Mon, 6 Jun 2011 10:10:32 +0000 (13:10 +0300)]
Return explicit NULL from dbiFreeIndexSet()
- Explicit NULL is much more obvious here, also eliminate the (now)
  dead NULL-assignments and add a trash-n-burn memset() just in case

13 years agoCosmetics: function blocks start on a new line
Panu Matilainen [Mon, 6 Jun 2011 10:09:15 +0000 (13:09 +0300)]
Cosmetics: function blocks start on a new line

13 years agoLift Dijkstra algorithm out of collectSCC() to separate function
Panu Matilainen [Wed, 1 Jun 2011 10:29:03 +0000 (13:29 +0300)]
Lift Dijkstra algorithm out of collectSCC() to separate function
- This splits outs nicely, moving queue allocation into separate
  scope and making collectSCC() less of an heavy-weight.
  No functional changes.

13 years agoEliminate struct copy in collectSCC(), use a pointer instead
Panu Matilainen [Wed, 1 Jun 2011 09:40:55 +0000 (12:40 +0300)]
Eliminate struct copy in collectSCC(), use a pointer instead
- collectSCC() doesn't actually modify the SCC struct it looks at
  so operating on a copy is harmless, but using a (const) pointer
  to the original makes the idea more clear (we're not modifying
  the scc struct here, only its members)

13 years agoClean up + simplify pgpsigFormat()
Panu Matilainen [Wed, 1 Jun 2011 08:31:55 +0000 (11:31 +0300)]
Clean up + simplify pgpsigFormat()
- Don't do manually what the computer can do for you, let rasprintf()
  calculate the string sizes
- Handle possible date conversion errors: if we can't format the
  date correctly then at least show the integer value along with
  a complaint

13 years agoSplit the --replacepkgs hack to a helper function and document it
Panu Matilainen [Wed, 1 Jun 2011 07:00:04 +0000 (10:00 +0300)]
Split the --replacepkgs hack to a helper function and document it
- Makes the huge rpmpsmStage() that little bit smaller, this
  special-case code does not belong inline there. Also gets rid
  of couple of dead assignments and unnecessary variable.
- Don't bother unless RPMPROB_FILTER_REPLACEPKG is set, it's not
  terribly expensive but its also wholly unnecessary in the normal case
- Document how the dang thing "works"

13 years agoMake test-case for --replacepkgs stricter
Panu Matilainen [Wed, 1 Jun 2011 06:35:47 +0000 (09:35 +0300)]
Make test-case for --replacepkgs stricter
- Actually verify we got the expected result, ie exactly one instance
  of the pkg installed after successful reinstall.

13 years agoReset cli configured flag on rpmcliFini() (RhBug:709421)
Panu Matilainen [Wed, 1 Jun 2011 06:01:24 +0000 (09:01 +0300)]
Reset cli configured flag on rpmcliFini() (RhBug:709421)

13 years agoCleanup rpmpsmNew() and rpmpsmFree()
Panu Matilainen [Tue, 31 May 2011 12:32:44 +0000 (15:32 +0300)]
Cleanup rpmpsmNew() and rpmpsmFree()
- Remove redundant checks and other fluff, including dead
  NULL-assignments on free

13 years agoRemove reamining dead assignments from rpmtsiFree() in transaction code
Panu Matilainen [Tue, 31 May 2011 09:43:15 +0000 (12:43 +0300)]
Remove reamining dead assignments from rpmtsiFree() in transaction code
- Not all of these are at the end of local scope and in many cases
  the iterator pointer is reused, but the logic in all these is
  straightforward enough (no jumps etc) that there's no much
  chance of mistakenly using already freed iterator.

13 years agoRemove dead NULL-assignment before reassign
Panu Matilainen [Tue, 31 May 2011 09:35:18 +0000 (12:35 +0300)]
Remove dead NULL-assignment before reassign

13 years agoRemove superfluous localtime() call
Panu Matilainen [Tue, 31 May 2011 09:27:58 +0000 (12:27 +0300)]
Remove superfluous localtime() call
- The tm pointer is reset to localtime(&when) before accessed,
  this is nothing but a dead call and assignment

13 years agoRemove dead keyp & keylen assignments in rpmdbNextIterator()
Panu Matilainen [Tue, 31 May 2011 08:57:45 +0000 (11:57 +0300)]
Remove dead keyp & keylen assignments in rpmdbNextIterator()
- Both get assigned to their values earlier in the loop and neither
  is used beyond this point in the loop .. so these are useless.

13 years agoClean up + clarify popMacro() a bit
Panu Matilainen [Tue, 31 May 2011 08:38:38 +0000 (11:38 +0300)]
Clean up + clarify popMacro() a bit
- Actually protect against NULL mep (shouldn't happen but...)
- Remove bogus comment + add actually relevant comments
- Make the *mep reassignment more obvious by taking it out of
  the if where its easily missed
- Replace dead NULL-assignments with a trash-n-burn memset()
- Fixup indentation to match general rpm style

13 years agoUse popMacro() when freeing the entire macro table
Panu Matilainen [Tue, 31 May 2011 07:38:17 +0000 (10:38 +0300)]
Use popMacro() when freeing the entire macro table
- We already have a function to free macro entries, use it to
  remove code duplication

13 years agoPass dbiClose() flags down to db->close()
Panu Matilainen [Tue, 31 May 2011 06:02:29 +0000 (09:02 +0300)]
Pass dbiClose() flags down to db->close()
- BDB of old might not have taken flags there but current ones
  do accept DB_NOSYNC to be specified (not that we use it but...)
- As a side-effect this eliminates another dead assignment

13 years agoReturn an explicit NULL from dbiFree(), remove dead assignment
Panu Matilainen [Tue, 31 May 2011 05:59:21 +0000 (08:59 +0300)]
Return an explicit NULL from dbiFree(), remove dead assignment

13 years agoRemove bogus condition on provide checking in query
Panu Matilainen [Tue, 31 May 2011 05:38:09 +0000 (08:38 +0300)]
Remove bogus condition on provide checking in query
- RPMQV_WHATPROVIDES only falls through to RPMQV_PATH on absolute
  paths, so the only place checking for provides_checked value would
  never be reached in the case it was set.
- Add a comment about the fallthrough case

13 years agoEliminate dead NULL-assignment by avoiding unnecessary allocation
Panu Matilainen [Mon, 30 May 2011 14:13:51 +0000 (17:13 +0300)]
Eliminate dead NULL-assignment by avoiding unnecessary allocation
- cpioHeaderRead() only needs to alloc after successfully reading
  the next filename from the cpio header, delay alloc until
  we know the read was successful.

13 years agoFix a logic error leading to unlink(NULL) call, oops.
Panu Matilainen [Mon, 30 May 2011 12:54:16 +0000 (15:54 +0300)]
Fix a logic error leading to unlink(NULL) call, oops.
- If writing the scriptlet to a file fails, its possible to
  end up with non-NULL script but with NULL fn and kaboom in unlink()

13 years agoEliminate bunch of dead assignments on ts vsflags
Panu Matilainen [Mon, 30 May 2011 12:50:29 +0000 (15:50 +0300)]
Eliminate bunch of dead assignments on ts vsflags
- The common pattern here is grabbing current flags to a local
  variable, modifying them for an operation and then restoring,
  which is fine... but we dont care about the previous flags
  when we're restoring them.

13 years agoEliminate dead assignment(s) on rpmfsFree(), memset() wipeout instead
Panu Matilainen [Mon, 30 May 2011 09:38:13 +0000 (12:38 +0300)]
Eliminate dead assignment(s) on rpmfsFree(), memset() wipeout instead

13 years agorpmgiFree() cleanup to remove an exit point and dead assignment(s)
Panu Matilainen [Mon, 30 May 2011 09:37:06 +0000 (12:37 +0300)]
rpmgiFree() cleanup to remove an exit point and dead assignment(s)

13 years agoRemove trailing dead NULL-assignments from sepoltransFree()
Panu Matilainen [Mon, 30 May 2011 09:25:04 +0000 (12:25 +0300)]
Remove trailing dead NULL-assignments from sepoltransFree()
- Replace assignments with a memset() to blast away the contents instead,
  taking care of other members too

13 years agoMinor cleanups to sepolLoadPolicies() in sepolicy plugin
Panu Matilainen [Mon, 30 May 2011 09:12:24 +0000 (12:12 +0300)]
Minor cleanups to sepolLoadPolicies() in sepolicy plugin
- Having an err label which we fall through on success too seems
  a bit funny, rename the label to exit
- Initialize the sepoltrans at declaration already
- Remove redundant RPMRC_FAIL assignment on sepoltransNew() fail
  case, this already assumes failure
- Remove redundant jump to exit from sepoltransCommit() error
- Eliminate trailing dead NULL assignment of the local pt variable

13 years agoReturn explicit NULL on sepoltransNew() failure
Panu Matilainen [Mon, 30 May 2011 09:04:18 +0000 (12:04 +0300)]
Return explicit NULL on sepoltransNew() failure

13 years agoRemove possibility of abusing freed iterator by moving to local scope
Panu Matilainen [Mon, 30 May 2011 08:45:41 +0000 (11:45 +0300)]
Remove possibility of abusing freed iterator by moving to local scope
- Eliminates another dead NULL-assignment + makes it "safer"

13 years agoEliminate obvious dead NULL-assignment at headerLoad() error exit
Panu Matilainen [Mon, 30 May 2011 08:25:51 +0000 (11:25 +0300)]
Eliminate obvious dead NULL-assignment at headerLoad() error exit

13 years agoEliminate dead NULL-assignment on lua scriptlet execution
Panu Matilainen [Mon, 30 May 2011 08:22:30 +0000 (11:22 +0300)]
Eliminate dead NULL-assignment on lua scriptlet execution
- alloc the luavar on entry, free on exit to remove any abuse
  possibilities

13 years agoEliminate a few dead NULL-assignment eliminations in rpmgraph
Panu Matilainen [Mon, 30 May 2011 08:00:31 +0000 (11:00 +0300)]
Eliminate a few dead NULL-assignment eliminations in rpmgraph
- There are more but leaving the rest as a reminder to clean
  up rpmGraph() someday when bored enough...

13 years agoSpring-cleaning for rpmdeps
Panu Matilainen [Mon, 30 May 2011 07:44:43 +0000 (10:44 +0300)]
Spring-cleaning for rpmdeps
- Depgen helpers take nno args, their input comes from stdin. Eliminates
  popt vs ARGV_t mismatch which would've caused us to blow up if
  it weren't for a memleak on the generated argv.
- Another memleak on the file classifier in case rpmfcClassify()
  or rpmfcApply() fails - just free all allocated resources at exit.
- Remove fluff: fgets() is guaranteed to \0-terminate non-NULL returns,
  eliminate unused/useless variables
- Fixup indentation where busted

13 years agoEliminate dead NULL-assignments at scope-end in main cli utils
Panu Matilainen [Mon, 30 May 2011 06:36:03 +0000 (09:36 +0300)]
Eliminate dead NULL-assignments at scope-end in main cli utils

13 years agoA few more dead NULL-assignment eliminations in low-level header code
Panu Matilainen [Sun, 29 May 2011 10:10:42 +0000 (13:10 +0300)]
A few more dead NULL-assignment eliminations in low-level header code

13 years agoMove db cursor to local scopes, remove dead NULL-assignments
Panu Matilainen [Sun, 29 May 2011 09:03:56 +0000 (12:03 +0300)]
Move db cursor to local scopes, remove dead NULL-assignments

13 years agoEliminate dead NULL-assignments at scope-end in librpmsign
Panu Matilainen [Sun, 29 May 2011 08:52:17 +0000 (11:52 +0300)]
Eliminate dead NULL-assignments at scope-end in librpmsign

13 years agoEliminate dead NULL-assignments at scope-end in librpm, part VI
Panu Matilainen [Sat, 28 May 2011 19:30:41 +0000 (22:30 +0300)]
Eliminate dead NULL-assignments at scope-end in librpm, part VI
- Remove NULL-assignments of local variables at the end of scope
  in "cli-level" code

13 years agoEliminate dead NULL-assignments at scope-end in librpm, part V
Panu Matilainen [Sat, 28 May 2011 19:29:58 +0000 (22:29 +0300)]
Eliminate dead NULL-assignments at scope-end in librpm, part V
- Remove NULL-assignments of local variables at the end of scope
  in transaction and database code

13 years agoEliminate dead NULL-assignments at scope-end in librpm, part IV
Panu Matilainen [Sat, 28 May 2011 19:28:53 +0000 (22:28 +0300)]
Eliminate dead NULL-assignments at scope-end in librpm, part IV
- Remove NULL-assignments of local variables at the end of scope
  in the higher level package-related "objects": rpmds, rpmfi, rpmte

13 years agoEliminate dead NULL-assignments at scope-end in librpm, part III
Panu Matilainen [Sat, 28 May 2011 19:26:39 +0000 (22:26 +0300)]
Eliminate dead NULL-assignments at scope-end in librpm, part III
- Remove NULL-assignments of local variables at the end of scope
  from the low-level helper machinery: fsm, psm, rpmscript and rpmrc

13 years agoEliminate dead NULL-assignments at scope-end in librpm, part II
Panu Matilainen [Sat, 28 May 2011 19:24:37 +0000 (22:24 +0300)]
Eliminate dead NULL-assignments at scope-end in librpm, part II
- Remove NULL-assignments of local variables at the end of scope
  in package+signature manipulation code

13 years agoEliminate dead NULL-assignments at scope-end in librpm, part I
Panu Matilainen [Sat, 28 May 2011 19:12:37 +0000 (22:12 +0300)]
Eliminate dead NULL-assignments at scope-end in librpm, part I
- Remove NULL-assignments of local variables at the end of scope
  in header + tag- and format-extension code. While this
  NULL-on-free idiom of rpm codebase is harmless as such, these
  unnecessary NULL-assignments have the effect of hiding real problems
  in the amount of noise they generate on code analysis.
- While the changes are supposedly trivial, doing this in smaller parts
  to make bisecting easier in case a some regression slips through.

13 years agoEliminate dead NULL-assignments from rpmio fd close functions
Panu Matilainen [Sat, 28 May 2011 16:45:07 +0000 (19:45 +0300)]
Eliminate dead NULL-assignments from rpmio fd close functions

13 years agoEliminate bunch of obvious dead NULL-assignments around librpmio
Panu Matilainen [Sat, 28 May 2011 16:43:52 +0000 (19:43 +0300)]
Eliminate bunch of obvious dead NULL-assignments around librpmio

13 years agoEliminate dead NULL-assignments on argvFree() and argiFree()
Panu Matilainen [Sat, 28 May 2011 16:42:54 +0000 (19:42 +0300)]
Eliminate dead NULL-assignments on argvFree() and argiFree()

13 years agoClean up spec %files -f <manifest> processing
Panu Matilainen [Sat, 28 May 2011 14:30:16 +0000 (17:30 +0300)]
Clean up spec %files -f <manifest> processing
- Split the manifest reading into a helper function
- Fix filename memleak when the file couldn't be opened and
  also check for ferror() on return from the fgets() loop - fgets()
  returns NULL on both EOF and error, previously an error would've
  gone silently unnoticed.o

13 years agoRemove pointless variable and a dead assignment to it
Panu Matilainen [Sat, 28 May 2011 08:34:51 +0000 (11:34 +0300)]
Remove pointless variable and a dead assignment to it

13 years agoClean up checkFiles() a bit
Panu Matilainen [Sat, 28 May 2011 08:30:55 +0000 (11:30 +0300)]
Clean up checkFiles() a bit
- Initialize variables on declaration, eliminate dead rc assignment

13 years agoEliminate bunch of obvious dead NULL-assingments from misc build parts
Panu Matilainen [Fri, 27 May 2011 13:46:23 +0000 (16:46 +0300)]
Eliminate bunch of obvious dead NULL-assingments from misc build parts

13 years agoRip hysterical hoop-jumping on spec/pkg cpiolist freeing
Panu Matilainen [Fri, 27 May 2011 13:27:34 +0000 (16:27 +0300)]
Rip hysterical hoop-jumping on spec/pkg cpiolist freeing
- Just call rpmfiFree() directly, wtf?

13 years agoEliminate dead NULL-assignments on parsePolicies() exit
Panu Matilainen [Fri, 27 May 2011 13:20:45 +0000 (16:20 +0300)]
Eliminate dead NULL-assignments on parsePolicies() exit

13 years agoEliminate bunch of obvious dead NULL-assignments from build script code
Panu Matilainen [Fri, 27 May 2011 12:49:09 +0000 (15:49 +0300)]
Eliminate bunch of obvious dead NULL-assignments from build script code

13 years agoEliminate bunch of obvious dead NULL-assignments from rpm generation
Panu Matilainen [Fri, 27 May 2011 12:38:54 +0000 (15:38 +0300)]
Eliminate bunch of obvious dead NULL-assignments from rpm generation

13 years agoEliminate dead NULL-assignments in parseFiles()
Panu Matilainen [Fri, 27 May 2011 11:44:03 +0000 (14:44 +0300)]
Eliminate dead NULL-assignments in parseFiles()

13 years agoEliminate dead NULL-assignments from rpmSpecFree()
Panu Matilainen [Fri, 27 May 2011 11:37:44 +0000 (14:37 +0300)]
Eliminate dead NULL-assignments from rpmSpecFree()

13 years agoEliminate dead NULL-assignments on OFI frees on spec parsing
Panu Matilainen [Fri, 27 May 2011 11:35:14 +0000 (14:35 +0300)]
Eliminate dead NULL-assignments on OFI frees on spec parsing

13 years agoMove build restriction header copying to local scope
Panu Matilainen [Fri, 27 May 2011 11:25:59 +0000 (14:25 +0300)]
Move build restriction header copying to local scope
- Eliminates accidental use of the variables, eliminating any
  need for NULL'ing the iterator

13 years agoClean up + plug memleak in parseDescription()
Panu Matilainen [Fri, 27 May 2011 11:12:55 +0000 (14:12 +0300)]
Clean up + plug memleak in parseDescription()
- Eliminate dead NULL-assignments of local variables on exit
- Move stringbuf free to exit, previously error on readLine() leaked
  memory here

13 years agoEliminate dead NULL-assignments on exit from parseScript()
Panu Matilainen [Fri, 27 May 2011 11:10:51 +0000 (14:10 +0300)]
Eliminate dead NULL-assignments on exit from parseScript()

13 years agoClean up + fix memleaks in readIcon()
Panu Matilainen [Fri, 27 May 2011 10:59:05 +0000 (13:59 +0300)]
Clean up + fix memleaks in readIcon()
- Assume failure and use single point of exit where all allocations
  are freed without dumb dead-assignments. Also fixes a
  leak from icon allocation when Fread() fails.

13 years agoEliminate bunch of obvious dead NULL assignments in preamble parsing
Panu Matilainen [Fri, 27 May 2011 10:53:36 +0000 (13:53 +0300)]
Eliminate bunch of obvious dead NULL assignments in preamble parsing

13 years agoMore dead NULL assignments of local variables in filelist processing
Panu Matilainen [Fri, 27 May 2011 10:45:58 +0000 (13:45 +0300)]
More dead NULL assignments of local variables in filelist processing

13 years agoEliminate dead NULL assignments on processMetadataFile() exit
Panu Matilainen [Fri, 27 May 2011 10:33:00 +0000 (13:33 +0300)]
Eliminate dead NULL assignments on processMetadataFile() exit

13 years agoMinor cleanup to doUntar() to eliminate dead assignments on free()
Panu Matilainen [Fri, 27 May 2011 10:25:32 +0000 (13:25 +0300)]
Minor cleanup to doUntar() to eliminate dead assignments on free()

13 years agoClean up rpmfcGenerateDependsHelper() (aka external depgen) a bit
Panu Matilainen [Fri, 27 May 2011 09:50:54 +0000 (12:50 +0300)]
Clean up rpmfcGenerateDependsHelper() (aka external depgen) a bit
- Remove redundant NULL check, rpmfiNext() handles it
- Move variables to local scope(s) from function scope where
  appropriate, remove dead NULL-assignments on free
- Log the "Finding ..." messages /before/ executing the (possibly
  long-running) dependency generation helpers
- rpmExpand() never returns NULL, don't bother testing for it

13 years agoEliminate a few more dead rpmdsFree() NULL assignments
Panu Matilainen [Fri, 27 May 2011 09:36:47 +0000 (12:36 +0300)]
Eliminate a few more dead rpmdsFree() NULL assignments
- No real chance of accidental misuse of freed data here...

13 years agoDon't bother NULL'ing everything on rpmfcFree()
Panu Matilainen [Fri, 27 May 2011 09:31:01 +0000 (12:31 +0300)]
Don't bother NULL'ing everything on rpmfcFree()
- Replace umphteen dead NULL-assignments with a trash-n-burn memset()
- Since we're already testing for NULL, dont free NULL fc (not
  that it matters)

13 years agoMinor cleanup to rpmfcExec()
Panu Matilainen [Fri, 27 May 2011 09:23:55 +0000 (12:23 +0300)]
Minor cleanup to rpmfcExec()
- remove redundant xav re-initialization
- dont bother NULL'ing local variables on exit

13 years agoMinor cleanups to rpmfcGenerateDepends()
Panu Matilainen [Fri, 27 May 2011 09:09:15 +0000 (12:09 +0300)]
Minor cleanups to rpmfcGenerateDepends()
- init genConfigDeps on declaration
- remove redundant NULL-checks: rpmfiNext() and rpmdsNext() check
  for and handle NULL cleanly, no need to test here.
- remove pointless local fileattr variable

13 years agoEliminate some dead assignments on rpmdsFree()
Panu Matilainen [Fri, 27 May 2011 08:55:31 +0000 (11:55 +0300)]
Eliminate some dead assignments on rpmdsFree()
- Move ds declaration to local scope so there's no chance of
  accidental use of already freed data, ds is not needed at
  function scope.

13 years agoAdd a helper function for creation namespaced dependency sets, use it
Panu Matilainen [Fri, 27 May 2011 08:52:27 +0000 (11:52 +0300)]
Add a helper function for creation namespaced dependency sets, use it

13 years agoMinor cleanups to rpmfcHelper()
Panu Matilainen [Fri, 27 May 2011 08:23:37 +0000 (11:23 +0300)]
Minor cleanups to rpmfcHelper()
- If runCmd() returns NULL there's no point in further processing,
  rearrange things to avoid extra work in that case. As a side-effect
  this also silences a false-positive NULL-deference warning from clang.

13 years agoEliminate dead assignment, early exit means failure already
Panu Matilainen [Fri, 27 May 2011 08:05:15 +0000 (11:05 +0300)]
Eliminate dead assignment, early exit means failure already

13 years agoCosmetics: rewrap/indent to fit 80 columns
Panu Matilainen [Fri, 27 May 2011 07:59:44 +0000 (10:59 +0300)]
Cosmetics: rewrap/indent to fit 80 columns

13 years agoSanitize handlePreambleTag() error returns
Panu Matilainen [Fri, 27 May 2011 07:45:28 +0000 (10:45 +0300)]
Sanitize handlePreambleTag() error returns
- Single point of exit, assume failure. There are plenty of calls
  here which can fail, each with different int/rpmRC return code
  styles when we simply want an RPMRC_OK/RPMRC_FAIL for the return.
  Also eliminates some dead rc assignments.

13 years agoEliminate a couple more dead increments in spec parsing code
Panu Matilainen [Fri, 27 May 2011 06:59:55 +0000 (09:59 +0300)]
Eliminate a couple more dead increments in spec parsing code

13 years agoEliminate bunch of dead increments in spec filelist parsing
Panu Matilainen [Fri, 27 May 2011 06:47:38 +0000 (09:47 +0300)]
Eliminate bunch of dead increments in spec filelist parsing

13 years agoClean up rpmrc include processing a bit
Panu Matilainen [Fri, 27 May 2011 06:40:23 +0000 (09:40 +0300)]
Clean up rpmrc include processing a bit
- Eliminate pointless switch-case when we only care about one
  possibility here. Also eliminate a dead-increment which becomes
  more obvious now with the surroundings unobfuscated.

13 years agoEliminate two dead increments in rpmrc platform processing
Panu Matilainen [Fri, 27 May 2011 06:35:22 +0000 (09:35 +0300)]
Eliminate two dead increments in rpmrc platform processing

13 years agoHandle readlink() failure in genCpioListAndHeader() correctly
Panu Matilainen [Fri, 27 May 2011 06:02:38 +0000 (09:02 +0300)]
Handle readlink() failure in genCpioListAndHeader() correctly
- It might be a rare condition but it /can/ happen, and previously
  that would cause '\0' written out of bounds (at negative array offset).
  Also leave room for the terminating '\0' at the end of buffer when
  calling readlink(), previously a link exactly the size of buffer
  would've been silently truncated.

13 years agoAdd test-cases for three RhBug:705115 scenarios
Panu Matilainen [Thu, 26 May 2011 11:24:46 +0000 (14:24 +0300)]
Add test-cases for three RhBug:705115  scenarios

13 years agoAdd tests for multilib file state dependencies
Panu Matilainen [Thu, 26 May 2011 11:01:34 +0000 (14:01 +0300)]
Add tests for multilib file state dependencies
- Testcase for the file state consideration implemented in commit
  566a15c9c08aa593d05e2f55f1c171a48bc1b1bc

13 years agoAdd two basic multilib conflict resolution tests
Panu Matilainen [Thu, 26 May 2011 10:49:38 +0000 (13:49 +0300)]
Add two basic multilib conflict resolution tests
- Add colored binary packages (as there's no guarantee we can build
  them from test-suite), test that colored conflicts get resolved
  to preferred color.

13 years agoColored conflict resolution part II
Panu Matilainen [Thu, 26 May 2011 11:16:14 +0000 (14:16 +0300)]
Colored conflict resolution part II
- Same as commit 7bbc9b073d9204f6ffb8a1091c189b80029d27a9 but
  within the to-be-installed set

13 years agoBoth files must be colored for multilib conflict resolution (RhBug:705115)
Panu Matilainen [Thu, 26 May 2011 08:40:55 +0000 (11:40 +0300)]
Both files must be colored for multilib conflict resolution (RhBug:705115)
- File conflicts should only be resolved to preferred color when
  both files are colored. Prior to this we would happily overwrite
  scripts with a clearly conflicting ELF binary.

13 years agoAdd -r flag to find-debuginfo.sh to invoke eu-strip --reloc-debug-sections.
Mark Wielaard [Wed, 25 May 2011 13:44:42 +0000 (15:44 +0200)]
Add -r flag to find-debuginfo.sh to invoke eu-strip --reloc-debug-sections.
- This is a new option to eu-strip that strips out/resolves relocations
  between .debug_* elf sections in ET_REL files. This can save a lot of
  space for kernel module.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
13 years agoDisable all scriptlets and collections centrally on --test and --justdb
Panu Matilainen [Wed, 25 May 2011 11:52:39 +0000 (14:52 +0300)]
Disable all scriptlets and collections centrally on --test and --justdb
- These are already taken care of in other places but they're littered
  a little bit of here and there, eg in case of collections these
  modes are only skipped deep down in the plugin code. This should
  make the intended behavior more obvious upfront.

13 years agoPermit %verifyscript from non-installed packages
Panu Matilainen [Wed, 25 May 2011 11:26:51 +0000 (14:26 +0300)]
Permit %verifyscript from non-installed packages
- Verification from non-installed packages can be useful sometimes:
  http://lists.rpm.org/pipermail/rpm-maint/2011-May/003015.html
- %verifyscript is unlike all other scriptlets so might as well
  take some shortcuts and bypass rpmteProcess() & all, just
  create a lone rpmte, force the header we got and call rpmpsmRun()
  directly on it, bypassing rpmteProcess() which is only an
  unnecessary complication here (based on patch by Michael Schroeder)

13 years agoDon't run collections on script stages like %pre/posttrans, ugh.
Panu Matilainen [Wed, 25 May 2011 11:03:57 +0000 (14:03 +0300)]
Don't run collections on script stages like %pre/posttrans, ugh.

13 years agoIssue an error on failure to replace original package on signing
Panu Matilainen [Wed, 25 May 2011 07:20:45 +0000 (10:20 +0300)]
Issue an error on failure to replace original package on signing
- Previously any failure on replacing the original package with the
  newly signed one would silently fail, causing rather confusing
  behavior when eg attempting to (re)sign readable but not writable
  packages.

13 years agoAdd support for nested Lua macro expansion (RhBug:490740)
Panu Matilainen [Tue, 24 May 2011 17:28:16 +0000 (20:28 +0300)]
Add support for nested Lua macro expansion (RhBug:490740)
- Lift the printbuffer accounting out of rpmlua into a struct of
  its own (Funny thing, this looks a whole lot like the macro
  expansion buffer and Good Ole StringBuf Brothers ... Boys ... Mam.
  Unify them one of these days maybe)
- Replace the simplistic on/off printbuffer with a stack of buffers,
  fixup the lone caller to use the new internal push/pop API.

13 years agoPlug a memory leak on Lua rpm.expand()
Panu Matilainen [Tue, 24 May 2011 16:59:36 +0000 (19:59 +0300)]
Plug a memory leak on Lua rpm.expand()

13 years agoBail out of debuginfo if stabs format encountered (RhBug:453506)
Panu Matilainen [Tue, 24 May 2011 14:23:37 +0000 (17:23 +0300)]
Bail out of debuginfo if stabs format encountered (RhBug:453506)
- The previous "silently ignore" policy produces bogus debuginfo
  packages on some architectures and fails with other mysterious
  errors on others, better just fail hard until (if ever) somebody adds
  stabs support.

13 years agoFix %prep parse error to abort build
Panu Matilainen [Tue, 24 May 2011 13:55:31 +0000 (16:55 +0300)]
Fix %prep parse error to abort build
- Previously in some cases parse error in %prep could emit an error msg
  but still continue building due to error code bogosity. Clean up
  the mess a bit: assume failure and actually return the res(ult) we
  calculated instead of nextPart.

13 years agoCosmetics: remove redundant/empty doxygen markup, comments etc
Panu Matilainen [Tue, 24 May 2011 12:42:27 +0000 (15:42 +0300)]
Cosmetics: remove redundant/empty doxygen markup, comments etc
- No functional changes.

13 years agoRemove unused length return variables on doHeaderUnload()
Panu Matilainen [Tue, 24 May 2011 12:38:33 +0000 (15:38 +0300)]
Remove unused length return variables on doHeaderUnload()
- doHeaderUnload() is safe to call with NULL lengthPtr, the length
  is only of interest to headerRead() and headerWrite()

13 years agoHandle HEADERFLAG_SORTED bit correctly in headerUnsort()
Panu Matilainen [Tue, 24 May 2011 11:07:12 +0000 (14:07 +0300)]
Handle HEADERFLAG_SORTED bit correctly in headerUnsort()
- Within rpm there's exactly one caller of headerUnsort() which has
  kinda taken care of re-sorting the header on exit, but only if it
  returns successfully, meaning the header sort status could've been
  left in inconsistent state with implications on consequent
  operations on that header. Also this is part of the public API
  yet callers have no chance of adjusting the flag when they call it
  (and why should they).
- Also dont bother sorting if the header is already in unsorted state.

13 years agoReturn explicit NULL on errors + frees in header code
Panu Matilainen [Tue, 24 May 2011 10:47:25 +0000 (13:47 +0300)]
Return explicit NULL on errors + frees in header code

13 years agoDo not die on empty changelog section
Michael Schroeder [Tue, 24 May 2011 05:51:56 +0000 (08:51 +0300)]
Do not die on empty changelog section

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
13 years agoDistinguish between macro primitives with and w/o arguments
Jindrich Novy [Mon, 23 May 2011 12:11:43 +0000 (14:11 +0200)]
Distinguish between macro primitives with and w/o arguments
- do argument presence checks only for those requiring arguments