Package: backupninja
Version: 1.1.0-2.1
Severity: normal
File: /usr/share/backupninja/sys
Tags: patch

If a device does not contain a partition table, it's not a bug if 
the partition table can't be saved. Unfortunately, the only way to 
distinguish between this situation, and a failure to read the 
partition table by sfdisk, is by parsing the error output:

--- /tmp/sys    2020-04-08 12:27:57.878926371 +0200
+++ sys 2020-04-08 12:36:45.277413427 +0200
@@ -618,10 +618,15 @@
          label=${dev#/dev/}
          label=${label//\//-}
          outputfile=${partitionsfile//__star__/$label}
-         debug "$SFDISK $sfdisk_options -d $dev > $outputfile 2>/dev/null"
-         $SFDISK $sfdisk_options -d $dev > $outputfile 2>/dev/null
+         debug "$SFDISK $sfdisk_options -d $dev 2>&1 > $outputfile"
+         debug "(Forcing LC_ALL=C for $SFDISK as we might have to parse error 
output)"
+         output=`LC_ALL=C $SFDISK $sfdisk_options -d $dev 2>&1 > $outputfile`
          if [ $? -ne 0 ]; then
-            warning "The partition table for $dev could not be saved."
+            if echo "$output" | grep -q ": does not contain a recognized 
partition table$"; then
+               debug "Device $dev does not contain a recognized partition 
table"
+            else
+               warning "The partition table for $dev could not be saved."
+            fi
          fi
       done
    fi

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.5.0-rc5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_NZ, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), LANGUAGE=en_NZ:en 
(charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages backupninja depends on:
ii  bash               5.0-6
ii  bsd-mailx [mailx]  8.1.2-0.20180807cvs-1+b1
ii  dialog             1.3-20190808-1
ii  mawk               1.3.4.20200120-2

backupninja recommends no packages.

Versions of packages backupninja suggests:
pn  borgbackup     <none>
ii  bzip2          1.0.8-2
ii  debconf-utils  1.5.73
pn  duplicity      <none>
ii  fdisk          2.34-0.1
ii  genisoimage    9:1.1.11-3.1
ii  hwinfo         21.68-1
pn  mdadm          <none>
pn  rdiff-backup   <none>
ii  rsync          3.1.3-8
pn  subversion     <none>
pn  trickle        <none>
ii  util-linux     2.34-0.1
pn  wodim          <none>

-- Configuration Files:
/etc/backupninja.conf changed [not included]

-- no debconf information


-- 
 .''`.   martin f. krafft <madduck@d.o> @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
  `-  Debian - when you have better things to do than fixing systems

Attachment: digital_signature_gpg.asc
Description: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)

Reply via email to