OESF Portables Forum
Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: rgrep on July 11, 2004, 07:53:11 am
-
Hi folks, I just posted this to the pdaXrom buglist but since it may affect other ROMs (including the Sharp ROM) I wanted to post it here also:
---
There in a bug in the /usr/bin/ipkg script which causes it to miss certain package dependencies. The problem arises when a package containing a non-alphanumeric character (i.e. [+.-]) has a dependency whose name does not contain these non-alphanumeric characters and is a substring of the package's name.
That is a very confusing description, so here is an example:
'vim-doc' depends on 'vim', but if you install 'vim-doc', ipkg will never automatically install 'vim' for you. This is true for all packages who are named in this format, e.g. vim-syntax depends on vim, sdl-net depends on sdl, xscreensaver-hacks depends on xscreensaver.
You can verify yourself by doing the following:
1) Choose a package which matches the above condition.
2) Make sure you don't have the missed dependency installed (i.e. if you want to test vim-syntax, make sure you don't have vim installed).
3) Execute the following (substituting the package name below with the one you chose):
ipkg info xscreensaver-hacks Depends
ipkg depends xscreensaver-hacks
For example, the output of the above for vim-doc and xscreensaver-hacks is:
bash-2.05b# ipkg info vim-doc Depends
Depends: vim
bash-2.05b# ipkg depends vim-doc
vim-doc
bash-2.05b# ipkg info xscreensaver-hacks Depends
Depends: libglade libgtk sudo xscreensaver
bash-2.05b# ipkg depends xscreensaver-hacks
xscreensaver-hacks libglade sudo
Notice that 'vim' and 'xscreensaver' are visible in the "Depends" line from "ipkg info" but are missing from the list generated by "ipkg depends".
The problem is caused by a misconception in the use of the "\<" and "\>" regular expression meta-characters in /usr/bin/ipkg. They are being used in the script to find the package's name in a list of packages, e.g. "\<$pkg\>". The definition of these characters from regex(7) states:
"... the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at the beginning and end of a word respectively. A word is defined as a sequence of word characters which is neither preceded nor followed by word characters. A word character is an alnum character (as defined by wctype(3)) or an underscore. ..."
That last sentence is important to note, especially since ipkg treats the following characters as valid package name characters:
[a-zA-Z0-9.+-]
As you can see, period (.), plus (+), and minus (-) are valid ipkg package names, but they will be treated by "\<" and "\>" as "the null string at the beginning and end of a word". So the string "<\vim\>" will match "vim-doc" when that wasn't the intention of the /usr/bin/ipkg script.
A more reliable regular expression to use is "^vim$" since it will never match "vim-doc". I propose the following patch to /usr/bin/ipkg:
549c549
< if ! echo $installed_pkgs | grep -q "\<$pkg\>"; then
---
> if ! echo $installed_pkgs | tr " " "\n" | grep -q "^$pkg$"; then
556c556
< if ! echo $all_deps | grep -q "\<$pkg\>"; then
---
> if ! echo $all_deps | tr " " "\n" | grep -q "^$pkg$"; then
648c648
< local depends=`ipkg_depends $pkg | sed -e "s/\<$pkg\>//"`
---
> local depends=`ipkg_depends $pkg | sed -e "s/^$pkg$//" -e "s/^$pkg //" -e "s/ $pkg$ / /" -e "s/ $pkg$//"`
I have tested the above fix and stand by it, but please email me if you have any questions or concerns.
Thanks,
Matt
-
We have seen you bug report and of course fix it in the upcomming release.