Page 1 of 1

pup_event new binaries

Posted: Sun 13 Jul 2014, 05:04
by 01micko
Last year Barry introduced his IPC mechanism written in BaCon. It was kind of an unfinished project. He used this to write a new pup_event_frontend_d program, again in BaCon, and this has been in all pups built since June last year.

new version 140714 includes modified probepart

Bugfixes
- drive_all wasn't installed to right place - thanks Keef
- probepart now reports correctly extended partitions - scripts adjusted
- mixed data/music CD's now open in defaultcdplayer or defaultmediaplayer

Unfortunately, there are still a few bugs in the BaCon and supporting scripts, probably because Barry retired not long after. Anyway, I am going some way to finishing this.

With the help of Peter Van Eerton (BaCon maintainer) and big_bass (see bacon forum) I was able to fix the bugs in the current BaCon sources and they compile with bacon-3.0.1 (latest beta) and work.

There are also bugs with CD detection, it's a pita as there are many different filesystems and audio cd's as well as blank cd/dvd's have no filesystem. To top it off, there is a bug in guess_fstype that detects the extended partition on one of my hard drives as NTFS! That means I was getting an icon on the desktop for it. It's a compaq CQ60 laptop, 140GB hdd, probably fairly common, but I have never heard of it reported as a bug. That doesn't mean it hasn't been reported, just that I haven't seen it.

So, the supporting scripts are hacked to death to accommodate swatting these bugs. But you know, kill 4 and 6 appear! :lol:

Ideally, the guess_fstype bug needs fixing. I did an strace and really there was little difference from the output of my real NTFS partition. That would eliminate one bug work around in the scripts. CD/DVD are a different story though.

On that note, this needs a fair bit of intensive testing.

WARNING:
: will only work in recent puppies running a rox desktop, may even bork those [s]irrepairably[/s] irreparably (spell check says irrepairably is not a word - oh well). On older pups it will break the desktop icons. If you want to try it though (at entirely your own risk) you need to delete /sbin/pup_event_frontend_d and replace it with a symlink to /usr/local/pup_event/pup_event_frontend_d

Code: Select all

cd /sbin
ln -sf ../usr/local/pup_event/pup_event_frontend_d . ### there is DOT after the last space
cd -
In the package is an install script which backs-up your current files. They can also be restored from the script.

Code: Select all

### to install
./install.sh
### to restore backup
./install.sh restore

*****Only 32 bit binaries are included



Have fun breaking stuff with that!

EDIT: Things to test
  • DVD's
  • blank disks (DVD/CD) - note some will report the capacity or size, some won't
  • music CD's
  • floppy disks and old zip disks
  • make sure you hard drive icons are correct

drive icons

Posted: Sun 13 Jul 2014, 09:21
by shinobar
Great :!:
Installed on 571JP.
Disappeared the fake drive icon for the extended partition sda2. :)

Code: Select all

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   140520554    70260246    7  HPFS/NTFS/exFAT
/dev/sda2       140520555   144729584     2104515    f  W95 Ext'd (LBA)
/dev/sda3       144729585   160071659     7671037+   c  W95 FAT32 (LBA)
/dev/sda5       140520618   144729584     2104483+   7  HPFS/NTFS/exFAT
sda1 is C:, sda5 is D:, sda3 is the Windows recovery.

Humm... probpert still reports wrong information for the sda2.
# probepart
/dev/sda1|ntfs|140520492
/dev/sda2|vfat|2
/dev/sda3|vfat|15342074
/dev/sda5|ntfs|4208966

Posted: Sun 13 Jul 2014, 09:33
by 01micko
Thanks for report shinobar.

Maybe probepart should be fixed to filter out extended partitions. I see yours gets detected as vfat. But my algorithm finds it and filters it because of it's single digit reported size.

If you can just test inserting a music CD and a blank CD/DVD it should detect them and for music open defaultcdplayer and blank opens pBurn (but I can change that to defaultburner or similar).

:)

Posted: Sun 13 Jul 2014, 10:32
by Keef
Extended partition also showing up in probepart, but without a filesystem type:

Code: Select all

# probepart 
/dev/sda1|ntfs|18429952
/dev/sda2|none|2
/dev/sda5|ext3|20480000
/dev/sda6|ext3|20480468
/dev/sda7|ext3|8192000
/dev/sda8|ext3|24012800
/dev/sda9|swap|3069952
/dev/sda10|ext4|10242048
/dev/sda11|ext3|12285952
/dev/sdb1|ext2|1982464
/dev/sr0|iso9660|1384284
Music CD opens with pMusic
Blank DVD does nothing when clicked on.
probepart

Code: Select all

/dev/sr0|none|4
Tried about 3 different blank DVDs just to make sure, but same results with each.

Some non-puppy bootable CD/DVDs launch Gnome Mplayer
with the error message:
Couldn't open DVD device :/dev/dvd (File exists)
This is a pre-exisiting 'bug' though. I got it with a Vinux CD-R and a GhostBSD DVD. Others do open correctly. Could possibly be slightly defective discs of course, but they have booted ok previously.

HDD icons all ok - possibly loading a bit quicker on startup, but will have to double check this at some time.

Posted: Sun 13 Jul 2014, 10:53
by 01micko
Thanks Keef!

When a data cd/dvd is inserted the program cddetect returns an exit status of 0. Some DVD's do this too. DVD's as far as I know are supposed to return 5 or 8.

Barry's block of code when 0 returns tries to figure out if it's a DVD (movie) or data. It may be somewhat drive dependent as I am 4 for 4 (quick test with 2 data DVDs and 2 movie DVDs and the result was as expected, on 2 separate machines).

Here is the block (plus I'll add the bit where I added pBurn).

It's part of a case statement: (/usr/local/bin/drive_all which becomes the AppRun in the rox app)

Code: Select all

  0) #failed to detect type.
   #cddetect does not work properly for dvd's, try something else...
   #100719 properly detect dvd video...
   if [ "`df | grep "$dPATTERN"`" = "" ];then #only test if not mounted.
    FLAGDVDVIDEO="`dvd+rw-mediainfo /dev/${ONEDRVNAME} | grep 'Mounted Media: .* DVD-ROM'`"
    if [ "$FLAGDVDVIDEO" = "" ];then
     #mount and look for 'video_ts' directory (dir should contain file video_ts.ifo)...
     mkdir -p /mnt/${ONEDRVNAME}
     mount -t iso9660 /dev/${ONEDRVNAME} /mnt/${ONEDRVNAME}
     if [ $? -eq 0 ];then
      [ -d /mnt/${ONEDRVNAME}/video_ts -o -d /mnt/${ONEDRVNAME}/VIDEO_TS ] && FLAGDVDVIDEO="yes"
      umount /mnt/${ONEDRVNAME}
     fi
    fi
    if [ "$FLAGDVDVIDEO" != "" ];then
     ln -snf /dev/${ONEDRVNAME} /dev/dvd
     [ -f /usr/local/bin/defaultdvdplayer ] && exec defaultdvdplayer
     [ "`grep '^exec mplayer' /usr/local/bin/defaultmediaplayer`" != "" ] && exec defaultmediaplayer dvdnav:// #140712 ^exec
     exec defaultmediaplayer dvd://
    fi
   fi
   ;;
   255) #might be blank, double check it's there #140712
     DISK=`cddetect_quick -d/dev/${ONEDRVNAME}`
     if [ "$DISK" = "disc inserted" ];then
       BURNER="xmessage 'no burner?'"
       type pburn &>/dev/null && BURNER=pburn
       exec "$BURNER"
     fi
   ;;
  esac
 
I suppose with blank discs it doesn't matter too much if nothing happens and I might revert that (the 255 case). It would be interesting to come up with a decent test for the DVD data v movie case though. A bit silly trying to play a data DVD!

Posted: Mon 14 Jul 2014, 00:22
by 01micko
EDIT: new probepart is included in the main download along with other bugfixes - see main post

@shinobar

I have patched probepart to look out for extended partitions, not by fs type. Instead we use fdisk of course at a slight speed penalty but it is not too much.

First the diff:

Code: Select all

--- /initrd/pup_ro2/sbin/probepart	2013-12-28 20:31:21.000000000 +1000
+++ /sbin/probepart	2014-07-14 10:25:41.029924508 +1000
@@ -62,6 +62,18 @@ else
 ${ALLDRVS}" | sort -V -u | tr '\n' ' '`"
 fi
 
+# guess_fstype really sucks for extended partitions - use fdisk but not in the main loop - too slow #140714
+EXTD=''
+printf "$ALLDRVS"|while read DISK
+do
+  FDISK="`fdisk -l /dev/"$DISK"`"
+  EXTD="`echo "$FDISK"|grep -w 'Extended'|grep "$DISK"|awk '{print $1}'`" 
+  EXTD=${EXTD##*/}
+  [ "$EXTD" ] && echo -n "$EXTD " >> /tmp/extended_parts
+done
+[ -f /tmp/extended_parts ] && EXTD="`cat /tmp/extended_parts`"
+rm /tmp/extended_parts 2>/dev/null
+
 for ONEDEV in $ALLDEVS
 do
  MEDIATYPE="" #130128
@@ -101,6 +113,7 @@ do
   fi
  fi
  FSTYPE="`guess_fstype /dev/$DEVICE 2>/dev/null`" #130128 note, audio-cd returns "unknown", as no f.s.
+ echo "$EXTD"|grep -q "$DEVICE" && FSTYPE='unknown' #140714 'Extended' partition, gets changed to 'none'
 
  if [ "$FSTYPE" = "unknown" -a "$MEDIATYPE" = "optical" ];then #130128 probe optical a bit more.
   cddetect -q -d/dev/${DEVICE} > /dev/null 2>&1

Now some tests with an old USB stick set up with Primary, Extended and Logical partitions with a variety of filesystems, and of course my main problematic disk. Comparison with the original probepart in the RO filesystem and speed tests. My old wrong result is marked.

Code: Select all

# probepart
/dev/sda1|ntfs|83968000
/dev/sda2|none|2
/dev/sda5|ext4|61440000
/dev/sda6|ext4|71680000
/dev/sda7|swap|4960256
/dev/sda8|ext4|90521600
/dev/sdb|none|0
/dev/sdc1|ext2|63488
/dev/sdc2|f2fs|15566848
/dev/sdd1|ntfs|313344
/dev/sdd2|vfat|67584
/dev/sdd3|none|2
/dev/sdd5|ext4|393216
/dev/sdd6|ext3|528384
/dev/sdd7|f2fs|641024
# /initrd/pup_ro2/sbin/probepart
/dev/sda1|ntfs|83968000
/dev/sda2|ntfs|2 ###wrong----------------------------------------
/dev/sda5|ext4|61440000
/dev/sda6|ext4|71680000
/dev/sda7|swap|4960256
/dev/sda8|ext4|90521600
/dev/sdb|none|0
/dev/sdc1|ext2|63488
/dev/sdc2|f2fs|15566848
/dev/sdd1|ntfs|313344
/dev/sdd2|vfat|67584
/dev/sdd3|none|2
/dev/sdd5|ext4|393216
/dev/sdd6|ext3|528384
/dev/sdd7|f2fs|641024
# time probepart
/dev/sda1|ntfs|83968000
/dev/sda2|none|2
/dev/sda5|ext4|61440000
/dev/sda6|ext4|71680000
/dev/sda7|swap|4960256
/dev/sda8|ext4|90521600
/dev/sdb|none|0
/dev/sdc1|ext2|63488
/dev/sdc2|f2fs|15566848
/dev/sdd1|ntfs|313344
/dev/sdd2|vfat|67584
/dev/sdd3|none|2
/dev/sdd5|ext4|393216
/dev/sdd6|ext3|528384
/dev/sdd7|f2fs|641024

real 	0m0.664s
user	0m0.027s
sys		0m0.023s
# time /initrd/pup_ro2/sbin/probepart
/dev/sda1|ntfs|83968000
/dev/sda2|ntfs|2 ###wrong--------------------------------------
/dev/sda5|ext4|61440000
/dev/sda6|ext4|71680000
/dev/sda7|swap|4960256
/dev/sda8|ext4|90521600
/dev/sdb|none|0
/dev/sdc1|ext2|63488
/dev/sdc2|f2fs|15566848
/dev/sdd1|ntfs|313344
/dev/sdd2|vfat|67584
/dev/sdd3|none|2
/dev/sdd5|ext4|393216
/dev/sdd6|ext3|528384
/dev/sdd7|f2fs|641024
 
real 	0m0.501s
user	0m0.013s
sys		0m0.027s
Yes, definitely slower but barely noticeable.

The probepart file is attached.

This will change the files I hacked in the first post, but more on that later.

Posted: Wed 16 Aug 2017, 16:32
by Argolance