[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#339482: patch to fix dpkg usage in glibc when /usr isnt mounted yet



This one time, at band camp, higuita said:
> Hi
> 
> tested in debian mips, works fine in my machines
> 
> replaced all (but one already commented) dpkg call with plain and old
> if tests
> 
> in the end, checking if the machine is running the correct architecture
> is hard to check and should be extremely rare, so i tweak it up and
> comment it

I think your logic in the checks is off.  Imagine this:

ver=2.6.14

if [ ${K_MAJOR} -lt 2 ] || [ ${K_MINOR} -lt 4 ] || [ ${K_REV} -lt 19 ] || [ "${ver[4]}" == "-pa17" ]
      false                     false                true                     false

evaluates to true, I would think.

This particular test is a little difficult6 to rewrite so
straightforwardly (evaluating the string bit at the end is not trivial)
The other tests are fairly straightforward and could be replaced things 
like:

if [ ${K_MAJOR} -le 2 ] && [ ${K_MINOR} -le 4 ] && [ ${K_REV} -lt 19 ] 

This tests pretty accurately that the numeric part is less than 2.4.19.
Once you start also testing for extensions like -pa17, it will get much
harder to handle.  Additionally, the == construct is a bashism.  Better
to use = for string tests or -eq for integer tests.

Take care,
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        sgran@debian.org |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature


Reply to: