Package: checkinstall
Version: 1.5.3-3
Followup-For: Bug #342578

The problem is line 211 in the checkinstall script (version 1.5.3-3):
206 function restore_backup {
207  ls ${TMP_DIR}/backup/*  &> /dev/null
208  if [ $? -eq 0 ]; then
209     echo -n "Restoring overwritten files from backup..."
210     cd ${TMP_DIR}/backup
211        tar -cpf - . | tar -f - -xvpC / &> /dev/null
212     okfail
213     echo
214  fi
215 }

Backups are by default enabled in checkinstall 1.5.3.

The $TMP_DIR/backup directory is created chmod 700 (it looks like it's created 
by installwatch):
ls -ld /var/tmp/GCZUQqPIlOGQmQcZCPbN/backup/
drwx------ 2 root root 48 2006-11-13 15:45 /var/tmp/GCZUQqPIlOGQmQcZCPbN/backup/

If ctrl-c is hit from inside checkinstall, the cleanup function is called.
The cleanup function then calls restore_backup.
If any files exist in $TMP_DIR/backup when restore_backup is called, it 
restores those files using the tar commands on line 211.

Line 211 tars up any files in $TMP_DIR/backup (including $TMP_DIR/backup 
itself), then restores those files and their permissions in /
Since $TMP_DIR/backup is chmod 700, after restoring the backup files, / will 
also be chmod 700

Perhaps line 211 should be changed to this?
tar -cpf - * | tar -f - -xvpC / &> /dev/null

-------------------

checkinstall 1.6.0 doesn't have this problem because translation is enabled by 
default:
function restore_backup {
 # If we have translation turned on then we didn't do a backup
 if [ "${TRANSLATE}" = "1" ]; then return 0; fi

 # Else, restore the backup if it exists

 rm -rf ${TMP_DIR}/BACKUP/no-backup &> /dev/null

 ls ${TMP_DIR}/BACKUP/*  &> /dev/null
 if [ $? -eq 0 ]; then
    echogn "Restoring overwritten files from backup..."
    cd ${TMP_DIR}/BACKUP
       $TAR -cpf - . | $TAR -f - -xvpC / &> /dev/null
    okfail
    echo
 fi
}

However, if translation were to be disabled, the problem would resurface.

-------------------

Note that checkinstall 1.6.1 was recently released...  (As far as this problem 
is concerned, checkinstall 1.6.1 and 1.6.0 behave the same)

-------------------

Two other unrelated bugs I came across while researching this one:

#1:
In checkinstall 1.6.0/1.6.1, due to the new translation feature, even if you 
tell checkinstall NOT to exclude files installed into `pwd`, it will exclude 
them.
The files in pwd need to be copied to the translation directory to be included 
in the package, but they aren't copied.
If translation is enabled, the files should be copied over (immediately after 
checking for files in pwd - around line 1525 in 1.6.0 - the user is given an 
opportunity to edit the list of files, and if the user adds any new files, 
those files are automatically copied if translation is enabled - but it doesn't 
happen unless '--inspect' is passed on the command line).

#2:
$TMP_DIR should begin with a '/' :
! [ "$BASE_TMP_DIR" ] && BASE_TMP_DIR=/var/tmp
TMP_DIR=${BASE_TMP_DIR}/`awk 'BEGIN { srand(); for (i=1;i<21;i++) { a=95; while 
(a > 90 && a < 97) { a=65+int(50*rand())}; printf("%c", a) } }'`

However, there are a number of places in the code where the variable is used as 
'/$TMP_DIR', so you end up with '//var/tmp/...'

Of course, it works just fine this way, but it can be a tad confusing and it is 
technically incorrect, so it is probably worth grepping the code for those 
cases and fixing them...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to