LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   a bug in dialog merged with Slackware64 current? (https://www.linuxquestions.org/questions/slackware-14/a-bug-in-dialog-merged-with-slackware64-current-4175612507/)

duturo1953 08-23-2017 12:20 PM

a bug in dialog merged with Slackware64 current?
 
Hello to all.
I recently went to Slackware Current and found out that some of my scripts, where I use intensive dialogs, did not work anymore.
After some correction attempts, there were mistakes in the code, I found instead that there is a tiny bug in the dialog program, only in the --file option.
I did try also the dialog --file from samples of dialog itslef, but also samples did'nt function.
(checklist9 and checklist9.txt. Here the code:
Code:

#! /bin/sh
# $Id: checklist9,v 1.8 2010/01/13 10:20:03 tom Exp $
# "checklist8" using --file

. ./setup-vars

. ./setup-tempfile

$DIALOG "$@" --file checklist9.txt 2>$tempfile

retval=$?

. ./report-tempfile

Here the text:

Code:

--help-button \
        --colors \
        --backtitle "\Z1No Such\Zn Organization" \
        --separate-output \
        --title "CHECKLIST BOX" \
        --checklist "Hi, this is a checklist box. You can use this to \n\
present a list of choices which can be turned on or \n\
off. If there are more items than can fit on the \n\
screen, the list will be scrolled. You can use the \n\
\Z4UP/DOWN\Zn arrow keys, the first letter of the choice as a \n\
hot key, or the number keys 1-9 to choose an option. \n\
Press \Zb\ZrSPACE\Zn to toggle an option on/off. \n\n\
  Which of the following are fruits?" 20 61 5 \
        "Apple"      "It's an \Z1apple\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"                    off \
        "Dog"        "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"                  ON  \
        "Orange"    "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"                    off \
        "Chicken"    "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"                    off \
        ""          "No such pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"                            off \
        "Cat"        "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN  \
        "Fish"      "Cats like \Z4fish\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"                  On  \
        "Lemon"      "You know how it \Zr\Zb\Z3tastes\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"    on


Reinstalled the Slackware64-14.2 dialog package, my scripts have resumed working perfectly.
I would like to point out to both the dialogue authors and Patrick Volkerding.

Here's an example of my scripts:

Code:

if ! ls *.iso; then
  dialog --no-cancel --title "Nessun file" --msgbox "\n\nNon c'è nessun file immagine iso nella \
  \ndirectory corrente. Esco dal programma." 10 50
  exit
fi

export NUMERO="$(ls *.iso | wc -l)"
if [ "$NUMERO" -ge 20 ]; then
    dialog --title "Spostamento e copia dei files" \
    --inputbox "\n\n\n(Anno_Numero_cd_NomeNumero\)\n\nQuale anno vuoi montare?\n\n\n" \
    0 0 "1997" 2>ANNO;
    if [ $? -eq 1 ]; then exit; fi
fi
export LANNO="$(cat ANNO)"
rm ANNO

function lodialogo(){
echo '--title "Ferrari Renato Software - Programma VirtualIso"  --no-cancel --separate-output \
--checklist "\nBenvenuti nel programma per montare \
\ni dischi immagine iso\
\nChe cosa scegli?\n\n" 0 0 0 \' > IMGvirt.txt
echo \"Uscita\" \"Esce dal programma\" "ON" \\ >> IMGvirt.txt

for CICCIO in "$LANNO"*.iso; do
  CICCIA="$(echo $CICCIO | rev | cut -f1 -d\/ | rev)"
  echo \"$CICCIO\" \"$CICCIA\" "OFF" \ \\ >> IMGvirt.txt ;
done
echo \"Tutti\" \"Tutte le immagini iso\" "OFF" >> IMGvirt.txt
dialog --file IMGvirt.txt 2>POPA
export DISCO="$(cat POPA)"
rm -f POPA
if [ `echo "$DISCO" | grep "Uscita"` ]; then
  mipulisco
  exit;
fi
}

function mipulisco(){
rm IMGvirt.txt &>/dev/null; 
for POPA in /mnt/minihd2/dischiimg/*; do
  sudo umount $POPA &>/dev/null;
done
rmdir /mnt/minihd2/dischiimg/*  &>/dev/null
}

lodialogo
MICONTO=1
if echo "$DISCO" | grep "Tutti"; then export DISCO="$(ls -1 "$LANNO"*.iso)"; fi
for CONTO in `echo "$DISCO" | cat`; do 
  export CONTA="$(echo "$CONTO" | rev | cut -f2- -d\. | rev)";
  mkdir -p /mnt/minihd2/dischiimg/"$MICONTO""_""$CONTA" &>/dev/null;
  sudo mount -o,loop "$CONTO" /mnt/minihd2/dischiimg/"$MICONTO""_""$CONTA" &>/dev/null;
  MICONTO=$((MICONTO+1));
done
kfmclient openProfile filemanagement /mnt/minihd2/dischiimg

where IMGvirt.txt is a file generate from script itself and
where dialog --file IMGvirt.txt 2>POPA is the command that don't funcion.
All other flags of dialog haven't bugs

In Slackware64-14.2 dialog package is:
dialog-1.2_20130523-x86_64-1.txz

In Slackware64-current dialog package is:
dialog-1.3_20160828-x86_64-1.txz

volkerdi 08-23-2017 02:26 PM

This bug was noted in the ChangeLog, and we fixed our own dialog-based scripts to not use the --file option. I've tested and found that the latest dialog does not have this bug, so I'll go ahead and upgrade dialog in -current. Hopefully there will not be any new bugs.


All times are GMT -5. The time now is 07:29 AM.