Xdialog error using either remaster method

Please post any bugs you have found
Post Reply
Message
Author
rrolsbe
Posts: 185
Joined: Wed 15 Nov 2006, 21:53

Xdialog error using either remaster method

#1 Post by rrolsbe »

I get the following "Usage for Xdialog" message right after I chose the simple method option. I get an orange box indicating it is calculating then get the long dialog message below. I keep thinking someone else would post with the same error, guess I am the only one having the problem.

Dougal, is there anyway to run your remaster utility from an Xterm and not use the GUI. If not, what would be the best way to debug this problem?

Xdialog v2.3.1 by Thierry Godefroy <xdialog@free.fr> (v1.0 was
written by Alfred at Cyberone Internet <alfred@cyberone.com.au>).
Xdialog home page available at: http://xdialog.dyns.net/

Usage: Xdialog [<common options>] [<transient options>] <box option> ...

Common options:
--wmclass <name>
--rc-file <gtkrc filename>
--backtitle <backtitle>
--title <title>
--allow-close | --no-close
--screen-center | --under-mouse | --auto-placement
--center | --right | --left | --fill
--no-wrap | --wrap
--cr-wrap | --no-cr-wrap
--stderr | --stdout
--separator <character> | --separate-output
--buttons-style default|icon|text

Transient options:
--fixed-font
--password (may be repeated 2 or 3 times before --2inputsbox or --3inputsbox)
--password=1|2 (for --2inputsbox or --3inputsbox)
--editable
--time-stamp | --date-stamp
--reverse
--keep-colors
--interval <timeout>
--timeout <timeout> (in seconds)
--no-tags
--item-help (if used, the {...} parameters are needed in menus/lists widgets)
--default-item <tag>
--icon <xpm filename>
--no-ok
--no-cancel
--no-buttons
--default-no
--wizard
--help <help>
--print <printer> (1)
--check <label> [<status>]
--ok-label <label>
--cancel-label <label>
--beep
--beep-after
--begin <Yorg> <Xorg>
--ignore-eof
--smooth

Box options:
--yesno <text> <height> <width>
--msgbox <text> <height> <width>
--infobox <text> <height> <width> [<timeout>]
--gauge <text> <height> <width> [<percent>]
--progress <text> <height> <width> [<maxdots> [[-]<msglen>]]
--inputbox <text> <height> <width> [<init>]
--2inputsbox <text> <height> <width> <label1> <init1> <label2> <init2>
--3inputsbox <text> <height> <width> <label1> <init1> <label2> <init2> <label3> <init3>
--combobox <text> <height> <width> <item1> ... <itemN>
--rangebox <text> <height> <width> <min value> <max value> [<default value>]
--2rangesbox <text> <height> <width> <label1> <min1> <max1> <def1> <label2> <min2> <max2> <def2>
--3rangesbox <text> <height> <width> <label1> <min1> <max1> <def1> ... <label3> <min3> <max3> <def3>
--spinbox <text> <height> <width> <min value> <max value> <default value> <label>
--2spinsbox <text> <height> <width> <min1> <max1> <def1> <label1> <min2> <max2> <def2> <label2>
--3spinsbox <text> <height> <width> <min1> <max1> <def1> <label1> ... <min3> <max3> <def3> <label3>
--textbox <file> <height> <width>
--editbox <file> <height> <width>
--tailbox <file> <height> <width>
--logbox <file> <height> <width>
--menubox <text> <height> <width> <menu height> <tag1> <item1> {<help1>}...
--checklist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--radiolist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--buildlist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--treeview <text> <height> <width> <list height> <tag1> <item1> <status1> <item_depth1> {<help1>}...
--fselect <file> <height> <width>
--dselect <directory> <height> <width>
--colorsel <text> <height> <width> [<red> <green> <blue>]
--fontsel <font name> <height> <width>
--calendar <text> <height> <width> [<day> <month> <year>]
--timebox <text> <height> <width> [<hours> <minutes> <seconds>]

Special options:
--version (prints version number to stderr and exits).
--print-version (same as above in a cdialog-compatible way).
--print-maxsize (prints maximum menu size in characters and exits).

Note that <height> and <width> are in characters and may be replaced by a single
XSIZExYSIZE[+/-XORG+/-YORG] parameter (like the one passed in the -geometry option
of X) which will represent the size of the Xdialog window in pixels. Specifying
a size of 0 0 (or 0x0) will auto-size Xdialog, while a size of -1 -1 (or -1x-1)
will maximize it.

(1) This Xdialog binary compiled with: lprshell -P<printer>
as the print command. If <printer> is "" (an empty string), the -P
option is not used.

Regards
Ron

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#2 Post by Dougal »

Try this.
Attachments
pupremaster.sh.gz
(9.34 KiB) Downloaded 762 times
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

rrolsbe
Posts: 185
Joined: Wed 15 Nov 2006, 21:53

Attached pupremaster.sh worked great! Thanks!

#3 Post by rrolsbe »

Will this version of pupremaster be in the 2.16 final?

Regards
Ron

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#4 Post by Dougal »

Beats me... There's been a similar version on the "updated remaster script" thread for a long time.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

leotan
Posts: 4
Joined: Tue 03 Sep 2013, 03:46

#5 Post by leotan »

Wow, this is an ancient bug. Sorry to bring this thread back to life but the bug is still current for puppy 528 at least and this thread is at the top of the Google results so I think it's better to post the solution here. There's a little bug in remasterpup versions 2 & 3 that causes it to abort with an Xdialog usage error message whenever there is an ISO image mounted.

In particular, there's a botched regex in the handling of the VIRTUALCD variable. To fix it, replace where it says:

Code: Select all

	
sed -e 's/on[ ].*+//'	
with this:

Code: Select all

	
sed -e 's/on [ ]*//'	
(mind the blanks).

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#6 Post by Karl Godt »

sed tends to exhibit problems with LANG or LC_ALL settings other than "", "en_US" or "C" .

Code: Select all

if [ "$NEW" = "yes" ]; then  ###### long skip if, cleating new sfs

VIRTUALCD=$(mount -t iso9660|grep '^/dev/loop' | sed -e 's/on[ ].*+//' -e 's/[ ]type[ ]iso9660[ ].*$//')
#VIRTUALCD="`grep -E "loop.*iso9660" /proc/mounts | cut -f 1-2 -d ' ' | tr '\n' ' '`" #110808 PANZERKOPF bug fix. 110822 reverted.
MSG="$m_14"
choice_cdd
I personally think that grep /proc/mounts is the better code line.

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#7 Post by npierce »

leotan,

Welcome to the forum. And thanks for the bug report and the fix for older Puppies. Barry rewrote this part of the code last February, so this bug is gone from new Puppies. But your fix will be useful for anyone who runs into this problem on an old Puppy.

Actually, the problem was not a "botched regex". That line of code did just what it was expected to do. The problem was that the expectations were unrealistically limited.

Here is why.

In Puppy, clicking on a the icon for an .iso file in the file manager will mount the iso image using Puppy's filemnt script. That script mounts the file at a mount point it creates using a name which is based on the filename of the image file. For instance, clicking on /mnt/sdb1/precise-5.7.1.iso will mount the image at /mnt/+mnt+sdb1+precise-5.7.1.iso, which is also the case if filemnt is run from the command line, like so:

Code: Select all

filemnt /mnt/sdb1/precise-5.7.1.iso
When an .iso file was mounted like that, remasterpup2 worked fine.

So the real problem was that remasterpup2 once expected all .iso files to be mounted that way, when in reality many people simply call mount, like so:

Code: Select all

mkdir /mnt/iso
mount -o loop /mnt/sdb1/precise-5.7.1.iso /mnt/iso
In the line that had the bug, the first s command existed to change this:

Code: Select all

/dev/loop1 on /mnt/+mnt+sdb1+precise-5.7.1.iso type iso9660 (ro,relatime)
to this:

Code: Select all

/dev/loop1 precise-5.7.1.iso type iso9660 (ro,relatime)
The second s command then changed it to this:

Code: Select all

/dev/loop1 precise-5.7.1.iso
This provided an easy to read item in remasterpup2's "Choose the CD/DVD drive..." list, showing the actual name of the .iso file, with no need for the user to horizontally scroll through "/mnt/+mnt+sdb1+" to bring the full name into the window.

But, as you discovered, if one just used the mount command to mount the .iso file, and the mount point didn't happen to contain a plus sign, what happened is that

Code: Select all

/dev/loop1 on /mnt/iso type iso9660 (ro,relatime)
didn't get changed by the first s command, so after the second s command this remained:

Code: Select all

/dev/loop1 on /mnt/iso
which confused Xdialog.


As Karl's post shows, an earlier attempt was once made to fix this bug. Unfortunately, that fix caused a failure for someone, and the fix was reverted. I don't know what circumstances caused the fix to fail, and the user didn't provide details. That fix looked OK to me. (See: http://murga-linux.com/puppy/viewtopic. ... 916#547916, http://murga-linux.com/puppy/viewtopic. ... 202#551202, http://murga-linux.com/puppy/viewtopic. ... 748#554748, http://murga-linux.com/puppy/viewtopic. ... 852#554852.)


Anyway, that is just history now, since the code for choosing $VIRTUALCD has been rewritten for new Puppies. And your suggested fix should make remasterpup2 compatible with .iso files that have been mounted with the mount command on any old Puppy that still has the bug.


By the way, in order to prevent confusion I should point out that although the bug you found in Puppy Lucid 5.2.8's remaster script has similar symptoms to the bug for which this thread was created, this is not the same bug. This thread refers to a 2007 version of a 2006 fork of the remaster script, pupremaster.sh, while the bug you found is in remasterpup2, and in a block of code that wasn't added until July 2009.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#8 Post by Karl Godt »

Hi Norman !

I have switched to leave the /+ -crap behind in filemnt , instead added a .$$ PID to the end of the mount point .
This is not the most perfect way but until now had no double .$$ PID .

Didn't liked the view of all these long directory names .


My current way of grep ing :

Code: Select all

grep -e '^/dev/loop[0-9]*.*iso9660' /proc/mounts | awk '{print $1 $2}' 
NOTE: cut would do also like awk , because special chars like ' ' space are escaped in /proc/mounts with ascii numbers .
bash-3.00.16 unfortunately seems not to work nice using inbuild echo -e to translate special chars back into the original characters - I am using busybox echo -e to do this .

NOTE : The is tr '\n' ' ' ' is nearly never been needed in practice , takes code space and resources .

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#9 Post by Karl Godt »

And sed would look like :

Code: Select all

S="/dev/loop1 on /mnt/+mnt+sdb1+precise-5.7.1.iso type iso9660 (ro,relatime)"
echo "$S" | sed 's%\(/dev/loop[0-9]*\) on \(/.*\) type iso9660 (.*)%\1 \2%' | sed 's%/mnt/.*+%%'
/dev/loop1 precise-5.7.1.iso

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

And so looks the code in precise-5.5.0 :

Code: Select all

#130222 fix this...
#VIRTUALCD=$(mount -t iso9660|grep '^/dev/loop' | sed -e 's/on[ ].*+//' -e 's/[ ]type[ ]iso9660[ ].*$//')
##VIRTUALCD="`grep -E "loop.*iso9660" /proc/mounts | cut -f 1-2 -d ' ' | tr '\n' ' '`" #110808 PANZERKOPF bug fix. 110822 reverted.
#VIRTUALCD="$(busybox mount | grep -E 'type udf|type iso9660' | cut -f 1,3 -d ' ' | tr '\n' ' ')"
VIRTUALCD=""
#130301 crap, earlier was using losetup-FULL from util-linux git, now using older 2.21.1, it needs -a param,
#but also truncates long lines (same as bb losetup) -- what a nuisance...
#BBLOSETUP="$(losetup-FULL -a | tr '\t' ' ' | tr -d '[:()]' | tr -s ' ')" #130301
for ONELOOP in `cat /proc/mounts | grep -E '(^/dev/loop.*)( udf | iso9660 )' | cut -f 1 -d ' ' | tr '\n' ' '` #130308 /dev/loop only
do
 oPTN="^${ONELOOP} "
 #ONEISO="$(echo "$BBLOSETUP" | grep "$oPTN" | rev | cut -f 1 -d '/' | rev)"
 ONEISO="$(cat /proc/mounts | grep "$oPTN" | cut -f 2 -d ' ' | rev | cut -f 1 -d '+' | cut -f 1 -d '/' | rev)" #130301
 [ "$ONEISO" = "" ] && continue #130301 precaution.
 VIRTUALCD="${VIRTUALCD} ${ONELOOP} ${ONEISO}"
done
LOL

Mainly for udf ...

BTW my puppy-4.3 remasterpup2 does not use any VIRTUALCD variable nor sed command :D .

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#11 Post by npierce »

Karl,

Thanks for sharing your methods. It's always nice to learn about alternative ways of doing things. I especially liked your use of back references to the parenthesized subexpressions in your sed command. I often forget that cool stuff like that can be done.

Post Reply