Description of problem: Various triggers in asymptote packages sport a code like this: VIMVEROLD=`rpm -q --qf='%{epoch}:%{version}\n' vim-common | sort | head -n 1 | sed -e 's/[0-9]*://' | sed -e 's/\.[0-9]*$//' | sed -e 's/\.//'` VIMVERNEW=`rpm -q --qf='%{epoch}:%{version}\n' vim-common | sort | tail -n 1 | sed -e 's/[0-9]*://' | sed -e 's/\.[0-9]*$//' | sed -e 's/\.//'` A simpler way to get similar results would be something along those lines set_vversions () { VIMVEROLD="$2" VIMVERNEW="$4" [ "$VIMVERNEW" ] || VIMVERNEW=$VIMVEROLD } set_vversions `rpm -q --qf='%{epoch} %{version}\n' vim-common \ | sort -n | sed -e 's/\.//' -e 's/\..*$//'` followed by a check if VIMVEROLD was actually set non-empty. This indeed should be 'sort -n' or otherwise a transition which bumps a number of digits in %{epoch} will sort incorrectly. Also version sorting may run into troubles. The same is true about the original trigger code. Version-Release number of selected component (if applicable): asymptote-1.31-1 and below
Michal, Thanks again for the report. I'll try to update both asymptote and syslog-ng this weekend. jpo
I started to wonder how reliable is a format of %{version} you will get from 'rpm -q ... vim-common'? Maybe a more paranoid sed would be in order? Something like that: ... | sed -e 's/\( [^.]*\.[^.]*\).*/\1/' -e 's/\.\([^.]*\)/\1/' If you will never get '.' from %{epoch} then this is too paranoid but conceivably not that much. OTOH it does not handle a situtation "dot in %{epoch} and no dot in %{version}". Something like that can be accounted for as well but if that is really a possibility then the easiest would be to process that inside of 'set_vversions' with a help of 'tr -d .'.
Err..., no. I am not thinking too well. AFAICS the following ... | sed -e 's/\( [^.]*\)\.\([^.]*\).*/\1\2/' handles every spread of dots correctly in one substitution.
I looked at the latest version of asimptote triggers and I think that %triggerpostun is still mildly incorrect. The idea is to remove old asy.vim links. If you would have more old versions and various VIMVEROLD would be produced for those (not very likely but something which could happen on a seriously messed up installation) then you would remove asy.vim only in one of those and that could leave after cleanup some "orphaned" directories behind. If you would do something like that instead: if [ $1 = 1 ]; then VIMVERNEW=`rpm -q --qf='%%{epoch} %%{version}\n' vim-common | \ sort -n | tail -n 1 | \ sed -e 's/[^ ]* \([^.]*\)\.\([^.]*\).*/\1\2/'` find "%{_datadir}/vim/" -name asy.vim | while read -r f ; do echo "$f" | grep -q vim/vim${VIMVERNEW} && continue rm -f "$f" done cd "%{_datadir}/vim/vim${VIMVERNEW}/syntax" 2>/dev/null && \ ln -sf ../../../%{name}/asy.vim . || : fi that would cover such convoluted situations too. If you are sure that no blanks will ever show up in file names then a simpler find .. | grep -v -q vim/vim${VIMVERNEW | xargs rm -f could be used instead but a practical difference is minimal. You do not need to test for a directory presence before 'cd'. If that is ok then the target exists. '%triggerun -- vim-common' is even bigger headeache and I would leave it alone. I am not sure why you added "[^ ]*" at the beginning of sed match pattern. If you can find blank in %{epoch} that you have a mess on hands anyway. If you cannot that this does not really change anything. Whatever you like.
Based on the date this bug was created, it appears to have been reported during the development of Fedora 8. In order to refocus our efforts as a project we are changing the version of this bug to '8'. If this bug still exists in rawhide, please change the version back to rawhide. (If you're unable to change the bug's version, add a comment to the bug and someone will change it for you.) Thanks for your help and we apologize for the interruption. The process we're following is outlined here: http://fedoraproject.org/wiki/BugZappers/F9CleanUp We will be following the process here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this doesn't happen again.
When I picked up this package, I got rid of these triggers, as they were really pointless.