Ticket #3789 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

extfs: rpm helper misses CONFLICTS field

Reported by: mooffie Owned by: zaytsev
Priority: major Milestone: 4.8.21
Component: mc-vfs Version: master
Keywords: Cc: slavazanko
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

The rpm helper has a typo. A fix suggested by users in #3750 and #3781 is:

  • src/vfs/extfs/helpers/rpm

    a b mcrpmfs_getDesription() 
    8989mcrpmfs_getAllNeededTags() 
    9090{ 
    9191    supportedTags=`mcrpmfs_getSupportedTags` 
    92     if test "`echo supportedTags | grep -c CONFLICTS`" -eq 1; then 
     92    if test "`echo $supportedTags | grep -c CONFLICTS`" -eq 1; then 
    9393       tag_CONFLICTS="|CONFLICTS=%{CONFLICTS}" 
    9494    else 
    9595       tag_CONFLICTS="" 

However, I suggest we remove the conditional altogether:

The conditional implies that in days past "CONFLICTS" wasn't a known tag to 'rpm', and that therefore 'rpm -qp --qf %{CONFLICTS} some_package.rpm' would raise an error -- something against which we need to protect.

But, looking in the helper's source code, we see other tags we use without protection and while I'm not familiar with 'rpm', I wonder why we assume they are "old and safe". Surely the ones we added recently (PRETRANS, ...) aren't that old.

Some other observations:

  • CONFLICTS support was added in 16bf1ca415c3f7 (year 2006), without protection, by somebody with an email from redhat.com. Perhaps we may rely on his "authority"?
  • The protection, together with the bug, was added in e7ed071be7f (#1590, year 2009) without explanation as part of a "total rewrite" of the script. I don't see people doing code review in that ticket.
  • We're still using CONFLICTS without protection in the 'trpm' helper.

To sum it up:

Should we add a "$", or remove the conditional altogether?

Change History

comment:1 Changed 7 years ago by mooffie

  • Summary changed from extfs: rpm helped misses CONFLICTS field to extfs: rpm helper misses CONFLICTS field

comment:2 Changed 7 years ago by zaytsev

  • Cc slavazanko added

As far as I know, "Conflicts" fields was introduced in RPM circa. 1996, so it's hard for me to imagine that there is some version out there that doesn't support it. I could hypothesize that some versions could crash if this field is not present in the archive or something, but honestly it's hard to know what Slava was thinking back then. Maybe he can elaborate himself?

I would favor rewriting mcrpmfs_getAllNeededTags to add checks for all fields just in case by constructing query format it a loop, but probably it's too annoying in shell :-( Removing the check altogether is the next best option.

comment:3 Changed 6 years ago by zaytsev

  • Milestone changed from 4.8.20 to 4.8.21

I think we should just remove the conditional :)

comment:4 Changed 6 years ago by zaytsev

  • Owner set to zaytsev
  • Status changed from new to accepted

comment:5 Changed 6 years ago by zaytsev

  • Status changed from accepted to testing
  • Votes for changeset set to committed-master
  • Resolution set to fixed
  • Branch state changed from no branch to merged

Committed to master: b44bfee6bf04ad2aa3742db00f8775895820c4f3 as agreed with andrew_b.

comment:6 Changed 6 years ago by zaytsev

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.