/usr/sbin/backupninja tr: misaligned [:upper:] and/or [:lower:] construct

Bug #60286 reported by Christian Holtje
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
backupninja
Fix Released
Unknown
backupninja (Debian)
Fix Released
Unknown
backupninja (Ubuntu)
Fix Released
Low
Emmet Hikory
Nominated for Dapper by Adam Buchbinder
Feisty
Invalid
Undecided
Unassigned

Bug Description

backupninja produces an error about tr whenever it is run

$ /usr/sbin/backupninja
tr: misaligned [:upper:] and/or [:lower:] construct
$

This is because the tr to make upper into lower case characters needs to be quoted. The alpha in toint() needs to be fixed, too.

This isn't fixed in the upstream trunk version, at this time.

Ciao!

Tags: patch
Revision history for this message
Matti Lindell (mlind) wrote :

What version of backupninja are you using?
With version 0.9.3-6 on Edgy I don't seem to get that error ($SHELL is dash).

Changed in backupninja:
status: Unconfirmed → Needs Info
Revision history for this message
Christian Holtje (docwhat) wrote :

Sorry for not doing the obvious. D'oh!

System Version: Dapper Drake (6.06LTS)
backupninja 0.9.2-3
/bin/sh is a symlink to bash

This is actually a bug, even with dash.

Script to demonstrate the problem. You can invoke it with any Bourne style shell you want and if the shell has globbing, it'll go boom: (see attachment)

This is true of the 'tr -d [:alpha:]' line too.

Example Output:
# env -i dash /tmp/bug.sh
+ DIR=/tmp/bug.demo1.9173
+ mkdir /tmp/bug.demo1.9173
+ cd /tmp/bug.demo1.9173
+ touch u
+ echo I WANT LOWER
+ tr u [:lower:]
tr: misaligned [:upper:] and/or [:lower:] construct
+ rm -rf /tmp/bug.demo1.9173

I suspect that I must have a single character filename wherever the
cwd of backupninja is when I run it via cron.

Sorry I didn't give you better information before. I don't know what
I was thinking.

Ciao!

Revision history for this message
Matti Lindell (mlind) wrote :

Ah, good catch! That's a bug alright.

Changed in backupninja:
status: Needs Info → Confirmed
Revision history for this message
Matti Lindell (mlind) wrote :

This should do it.

Revision history for this message
Emmet Hikory (persia) wrote :

IThank you for the patch. My apologies it has been lo long without review. I have added the patch tag to help packagers find and review the patch. I have unsubscribed ubuntu-universe-sponsors, as there is not a new revision candidate patch (in debdiff format) prepared for upload. If a debdiff for this bug is prepared, please resubscribe ubuntu-univserse-sponsors.

Revision history for this message
Matti Lindell (mlind) wrote :

patch against gutsy's version

Emmet Hikory (persia)
Changed in backupninja:
assignee: nobody → persia
importance: Undecided → Low
status: Confirmed → In Progress
Revision history for this message
Emmet Hikory (persia) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 08 Jun 2007 16:19:12 +0900
Source: backupninja
Binary: backupninja
Architecture: source
Version: 0.9.4-6ubuntu2
Distribution: gutsy
Urgency: low
Maintainer: Ubuntu MOTU Developers <email address hidden>
Changed-By: Emmet Hikory <email address hidden>
Description:
 backupninja - lightweight, extensible meta-backup system
Launchpad-Bugs-Fixed: 60286
Changes:
 backupninja (0.9.4-6ubuntu2) gutsy; urgency=low
 .
   [ Matti Lindell ]
   * src/backupninja.in:
     - fix misaligned translates in tolower() and toint() functions
       (LP: #60286)
 .
   [ Emmet Hikory ]
   * Set Maintainer to match DebianMaintainerSpec
Files:
 32487d55c5c1ceee2e58a0518f4cadfe 720 admin optional backupninja_0.9.4-6ubuntu2.
dsc
 b1d25be0a4940a2506029341afb58ff9 14170 admin optional backupninja_0.9.4-6ubuntu
2.diff.gz
Original-Maintainer: Micah Anderson <email address hidden>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGaQMX58vd3QD9QFcRAsp/AJ4rfHDdhh3ULD60+1ugru3y9Ezn6QCgnLL0
/BgVPbEGA0P+foCrbSZVLUg=
=ezMd
-----END PGP SIGNATURE-----

Changed in backupninja:
status: In Progress → Fix Committed
Revision history for this message
Emmet Hikory (persia) wrote :

backupninja (0.9.4-6ubuntu2) gutsy; urgency=low

  [ Matti Lindell ]
  * src/backupninja.in:
    - fix misaligned translates in tolower() and toint() functions
      (LP: #60286)

  [ Emmet Hikory ]
  * Set Maintainer to match DebianMaintainerSpec

 -- Emmet Hikory <email address hidden> Fri, 08 Jun 2007 16:19:12 +0900

Changed in backupninja:
status: Fix Committed → Fix Released
Revision history for this message
Adam Buchbinder (adam-buchbinder) wrote :

From https://wiki.ubuntu.com/StableReleaseUpdates#head-a7a957d3d691c2754ba24e5085481107ed703b49 :

1. This problem can cause the backup process to mysteriously fail without throwing any errors, as backupninja's "is it time to run the backups?" routine always returns false if there's a file named (for instance) "a" in /root. This bit my organization, causing us to have a significant gap in our backups; if we'd had a disaster while this was going on, a great deal of work would have been lost.

2. The bug is fixed by properly quoting three [:class:] instances; this has been out in Gutsy (and now Hardy) for nine months now; it was fixed in 0.9.4-6ubuntu2, which is one release after the version in Feisty (0.9.4-6ubuntu1).

3. A minimal patch to the one affected file is attached.

4. The bug can be easily reproduced on Feisty by running "touch /root/a" and noting that no backups ever run without being forced to (using backupninja -n).

5. The regression potential is minimal: there have been no side effects reported from the patch's application to the current version in the last nine months, and the change will, in the vast majority of cases, function identically. it has also been applied upstream for at least six months ( http://code.autistici.org/trac/backupninja/ticket/11 ). It only makes the package function consistently in the case that a specially-named file happens to be present in /root.

Revision history for this message
Adam Buchbinder (adam-buchbinder) wrote :

Pardon me; that should be "applied upstream for at least five months"; it was patched there on October 12, 2007.

Christian Reis (kiko)
Changed in backupninja:
importance: Undecided → Unknown
status: New → Unknown
Changed in backupninja:
status: Unknown → Fix Released
Revision history for this message
LaserJock (laserjock) wrote :

I think this is worth doing an SRU. +1 from me. Please proceed with preparing a package and debdiff and get MOTU to upload it to -proposed.

Revision history for this message
Luca Falavigna (dktrkranz) wrote :

If no-one provides a debdiff, I'll test and upload a fix soon.

Changed in backupninja:
status: New → Confirmed
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

Feisty seems not affected.

Changed in backupninja:
status: Confirmed → Invalid
Revision history for this message
Adam Buchbinder (adam-buchbinder) wrote :

Feisty *is* affected. Looking at the source for backupninja 0.9.4-6ubuntu1 (the version in Feisty):

$ grep '\[:' backupninja-0.9.4/src/backupninja.in
 echo "$1" | tr [:upper:] [:lower:]
 echo "$1" | tr -d [:alpha:]

The [:expressions:] should be single-quoted; the bug is present in this version, and can cause data loss, as explained in the SRU request above. This can be fixed by backporting the version from Gutsy (0.9.4-6ubuntu2) to Feisty, or by applying the attached debdiff.

Changed in backupninja:
status: Invalid → Confirmed
Revision history for this message
Adam Buchbinder (adam-buchbinder) wrote :

Pardon me; I didn't notice that Feisty is unsupported at this point. A patch for Dapper is forthcoming; this is server software, so it's certainly still apropos there and will be for a few years.

Changed in backupninja:
status: Confirmed → Invalid
Revision history for this message
Adam Buchbinder (adam-buchbinder) wrote :

Attached find a debdiff against backupninja 0.9.2-3, the version currently in Dapper. I'd like to submit this patch for an SRU, for the reasons outlined above.

Changed in backupninja:
status: Unknown → 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.