Misc syntax errors

Bug #638267 reported by chocolateboy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ppa-purge
Fix Released
Medium
Unassigned

Bug Description

ppa-purge 0.28 dies with a syntax error when it executes the double loop in the following line (142):

    # Disable PPA from sources.list files
    for LIST in for LIST in $(find /etc/apt/ -name "*.list" -exec readlink '{}' \;); do; do

The error is:

    /usr/sbin/ppa-purge: 142: Syntax error: ";" unexpected

Encountered when trying to uninstall ppa:tiheum/equinox, but I've seen it before. Also reported here

http://ammonkey.posterous.com/ppa-nautilus-elementary-230-for-lucid-is-out

Ubuntu: 10.04
ppa-purge: 0.2.8-1~lffl~lucid~ppa
sh (dash): 0.5.5.1-3ubuntu2

Revision history for this message
chocolateboy (chocolateboy) wrote :

Presumably it's a typo as there's only one "done". Changing it to:

    for LIST in $(find /etc/apt/ -name "*.list" -exec readlink '{}' \;); do

- fixes that error, but then two additional errors occur:

    Updating packages lists
    /usr/sbin/ppa-purge: 165: APT: not found
    /usr/sbin/ppa-purge: 165: APTALT: not found

If these are changed to $ALT and $APTALT the script works. Patch attached.

summary: - Syntax error in double loop
+ Misc syntax errors
Revision history for this message
chocolateboy (chocolateboy) wrote :

Also, readlink returns empty if the file isn't a symlink. readlink -f falls back to the original filename. (None of the ~20 .list files in my /etc/apt are symlinks). Updated patch attached.

Lorenzo De Liso (blackz)
Changed in ppa-purge:
assignee: nobody → Lorenzo De Liso (blackz)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Tormod Volden (tormodvolden) wrote :

Patch looks good. However, if APTALT may be undefined, it should be quoted (-z "$APTALT") in the snippet below:
 PPAOWNER=$1
-if [ ! -z APTALT ]; then
+if [ ! -z $APTALT ]; then
  APT=aptitude; APTALT=apt-get

Revision history for this message
chocolateboy (chocolateboy) wrote :

Thanks!

New patch attached.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Well, the quoting is actually already fine in http://bazaar.launchpad.net/~ppa-purge/ppa-purge/ubuntu/files

What version is your patch against? I would recommend that you create your own bzr branch of this repo, so that you can be sure your fixes apply to the current code. You can then simply make a merge request instead of posting a patch. A bit of a overhead for one small fix, but we are looking forward to more of your contributions :) Thanks in advance.

Revision history for this message
Lorenzo De Liso (blackz) wrote :

"for LIST in for LIST in $(find /etc/apt/ -name "*.list" -exec readlink '{}' \;); do" instead of "for LIST in for LIST in $(find /etc/apt/ -name "*.list" -exec readlink '{}' \;); do; do" (which doesn't exist in the latest ppa-purge version) should be modified. However, I applied your change and I will include that in the latest ppa-purge version. Thanks!

Revision history for this message
Lorenzo De Liso (blackz) wrote :

Fixed in the version 0.2.8+bzr55.

Changed in ppa-purge:
assignee: Lorenzo De Liso (blackz) → nobody
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.