Page 1 of 4

Posted: Fri 17 May 2013, 05:59
by Ibidem
jamesbond wrote:
technosaurus wrote:
jamesbond wrote:Attached is a patch that will make bb_guess_fstype
I bet Denys would accept it as a replacement for blkid if we added UUID and label - they are just at different offsets and most seem to already be documented in the source already.
I'm not so sure, I thought that's what blkid is for. The code in volume_id is actually meant for blkid, and in all the filesystem probes they actually stores both the label and the UUID if available (in fact, some of the unused probes seem to work right but they don't have UUID and labels identified properly and my guess is that why Denys left them out atm). I would be happy to drop guess_fstype altogether if only busybox blkid can specify which device to probe (instead of probing all) - but alas they are not.
Do you mean like "busybox blkid /dev/sda1" ?
If so, it works with busybox 1.21.
But if you mean like "busybox blkid /dev/sda", that doesn't work; you must use "for d in /dev/sda*; do blkid $d; done"
blkid does need to print at least TYPE and LABEL as well to match the standard version.

Posted: Sun 19 May 2013, 06:00
by jamesbond
Ibidem wrote:Do you mean like "busybox blkid /dev/sda1" ?
If so, it works with busybox 1.21.
But if you mean like "busybox blkid /dev/sda", that doesn't work; you must use "for d in /dev/sda*; do blkid $d; done"
blkid does need to print at least TYPE and LABEL as well to match the standard version.
Actually, I was wrong and you are right - even my current 1.19.4 busybox already does that :oops:

The real problem is this: if I pass a devpath for something that blkid doesn't understand (try passing an "extended partition" device)
a) util-linux blkid will produce no output.
b) busybox blkid will dump output for *ALL* devices.
Of course we can get around that in scripts, but that's *annoying*.

Posted: Mon 20 May 2013, 08:15
by Ibidem
jamesbond wrote:
Ibidem wrote:Do you mean like "busybox blkid /dev/sda1" ?
If so, it works with busybox 1.21.
But if you mean like "busybox blkid /dev/sda", that doesn't work; you must use "for d in /dev/sda*; do blkid $d; done"
blkid does need to print at least TYPE and LABEL as well to match the standard version.
Actually, I was wrong and you are right - even my current 1.19.4 busybox already does that :oops:

The real problem is this: if I pass a devpath for something that blkid doesn't understand (try passing an "extended partition" device)
a) util-linux blkid will produce no output.
b) busybox blkid will dump output for *ALL* devices.
Of course we can get around that in scripts, but that's *annoying*.
With busybox 1.21.0, it will produce no output (tested with /dev/sda4)
This is proper behavior, since that device has no UUID.
Also, it seems LABEL is now supported. TYPE, however, isn't.

Hmm...I wonder if an mdev hook could use blkid for /dev/disks/by-*

And I believe busybox has code to detect filesystems, but good luck finding it.

Posted: Mon 20 May 2013, 20:23
by Ibidem
musher0 wrote:To whom it may concern:

At least reintroduce the prompt function and the command function in busybox's less (-P and !<command> parameters).

Or remove less from busybox altogether. Because, as it is now, busybox's less is a joke.

It's a shame that such an excellent pager/reader with so many useful options be reduced to not even a workable skeleton of itself in busybox.

It's also misrepresentation, on an ethical level, but that is another subject.

musher0
From "reintroduce" I get the impression that you are saying it was in busybox at one point...if that is correct, when was that? (I couldn't find any indications in the git log.)

By the way, for my own purposes, (current) busybox less is quite adequate in a way that more falls far short of.

Posted: Tue 21 May 2013, 15:40
by jamesbond
Ibidem wrote:With busybox 1.21.0, it will produce no output (tested with /dev/sda4)
This is proper behavior, since that device has no UUID.
Also, it seems LABEL is now supported. TYPE, however, isn't.
Well :shock: It wasn't obvious from the code. Perhaps it's time to upgrade :evil: I'm quite sure it supports type because in 1.19.4 it does show type. Perhaps you didn't enable a compile-time option.
Hmm...I wonder if an mdev hook could use blkid for /dev/disks/by-*
Probably.
And I believe busybox has code to detect filesystems, but good luck finding it.
It does, in util-linux/volume_id. That's what my patch is for :wink: to make a standalone executable out of these filesystem detection code.

Posted: Wed 22 May 2013, 23:36
by Ibidem
jamesbond wrote:
Ibidem wrote:With busybox 1.21.0, it will produce no output (tested with /dev/sda4)
This is proper behavior, since that device has no UUID.
Also, it seems LABEL is now supported. TYPE, however, isn't.
Well :shock: It wasn't obvious from the code. Perhaps it's time to upgrade :evil: I'm quite sure it supports type because in 1.19.4 it does show type. Perhaps you didn't enable a compile-time option.
Hmm...I wonder if an mdev hook could use blkid for /dev/disks/by-*
Probably.
And I believe busybox has code to detect filesystems, but good luck finding it.
It does, in util-linux/volume_id. That's what my patch is for :wink: to make a standalone executable out of these filesystem detection code.
You are correct, I hadn't enabled it.:oops:
TYPE is conditional.

LABEL support, however, was present by 2008 according to the git log (one commit from just before 1.13.0 was tagged shows sample output with LABEL included)...
Edit: Whoops, you meant the change of behavior when the device specified doesn't have a UUID. That would be this commit:

Code: Select all

commit e8cfc3f693e8a0cbfc489564c76e00c074f63066
Author: Denys Vlasenko
Date:   Sat Mar 3 15:09:07 2012 +0100

    blkid: if parameters are given, do not scan /dev
    
    Signed-off-by: Denys Vlasenko

Also, here's something I'd forgotten about.

Code: Select all

#!/bin/busybox ash
#Assume $MDEV is the device name
#Make /dev/disk/by-* symlinks

if [ -z "$MDEV" ]
then 
 echo 'Use from mdev/conf'; env >>/var/log/mdev-blk.log
# This expands to "export" when no output, or to a sequence of assignments
else
 export `blkid "/dev/$MDEV" |cut -d : -f 2` >/dev/null|| true
 [ -n "$LABEL" ] && mkdir -p /dev/disk/by-label && \
 ln -sf "/dev/$MDEV" "/dev/disk/by-label/`echo $LABEL|tr -d '"'`" || true
 [ -n "$UUID" ] && mkdir -p /dev/disk/by-uuid && \
 ln -sf "/dev/$MDEV" "/dev/disk/by-uuid/`echo $UUID|tr -d '"'`" || true

 exec >>/var/log/mdev-blk.log
 echo "blkln $@"
 env
 echo ===
fi
There may be issues with this, I didn't throw any pathological cases at it.

Posted: Wed 22 May 2013, 23:49
by Ibidem
And here's the old nroff applet (as gzipped patch)
Part of this is a tweak to man that deletes the use of gtbl.

md5sum:
93ab39ade0b6f8b4c85750e0aed55ee4 bb-nroff.diff.gz

Posted: Thu 23 May 2013, 06:33
by Ibidem
jamesbond wrote: Anyway, as it is now, busybox guess_fstype takes 2.5 times the time of the original guess_fstype :shock:, but I'll take use it anyway because it is still in milliseconds range and it is more maintainable. I am re-posting the patch because the original one I posted was buggy (forgot to return pointer value in xzalloc :evil: - but it worked previously as long as I didn't turn on optimisation ...).
Just for reference: here's a "guess_fs" patch based on the previous patches that provides an applet.
I did a bit of cleanup and used the //config: //applet: //kbuild: approach, which reduces the risk of patches getting stale.
Also, I added support for multiple device names.

Posted: Thu 30 May 2013, 08:34
by musher0
Ibidem wrote:
musher0 wrote:To whom it may concern:

At least reintroduce the prompt function and the command function in busybox's less (-P and !<command> parameters).

Or remove less from busybox altogether. Because, as it is now, busybox's less is a joke.

It's a shame that such an excellent pager/reader with so many useful options be reduced to not even a workable skeleton of itself in busybox.

It's also misrepresentation, on an ethical level, but that is another subject.

musher0
From "reintroduce" I get the impression that you are saying it was in busybox at one point...if that is correct, when was that? (I couldn't find any indications in the git log.)

By the way, for my own purposes, (current) busybox less is quite adequate in a way that more falls far short of.
Hello, Ibidem.

"Re-introduce" in the sense of putting back in the busybox less some of the functions it removed from the real less. I don't think those functions mentioned above were ever in the busybox less.

The difference can be illustrated by the size of the --help :
if I remember correctly : busybox less -> 4 lines
the real less -> 4 pages.

In my mind, it's clear that the busybox less is mis-representing the real less. Is there a doc telling the user what functions busybox has removed from the utilities it is supposed to replace? If not...

BTW, if you look in the /bin directory, you'll see quite a few busybox functions that BK himself has marked as "BB-NOT-USED". And he then provided the real program or a suitable replacement.

The problem here is that the user is not made aware of what (s)he is missing. If I had not searched the Internet, I would still not know all the possibilities of the real less. But not all users are as persistent.

You never know when you will need the full version of the utility replaced by a busybox "applet".

Best regards.

musher0

Posted: Tue 04 Jun 2013, 17:26
by jamesbond
Ibidem wrote:Just for reference: here's a "guess_fs" patch based on the previous patches that provides an applet.
I did a bit of cleanup and used the //config: //applet: //kbuild: approach, which reduces the risk of patches getting stale.
Also, I added support for multiple device names.
Thanks Ibidem,

This is indeed excellent! Image.
There is no reason to keep the old guess_fstype anymore :)

Posted: Wed 05 Jun 2013, 03:08
by Ibidem
musher0 wrote:
Ibidem wrote:
musher0 wrote:To whom it may concern:

At least reintroduce the prompt function and the command function in busybox's less (-P and !<command> parameters).

Or remove less from busybox altogether. Because, as it is now, busybox's less is a joke.

It's a shame that such an excellent pager/reader with so many useful options be reduced to not even a workable skeleton of itself in busybox.

It's also misrepresentation, on an ethical level, but that is another subject.

musher0
From "reintroduce" I get the impression that you are saying it was in busybox at one point...if that is correct, when was that? (I couldn't find any indications in the git log.)

By the way, for my own purposes, (current) busybox less is quite adequate in a way that more falls far short of.
Hello, Ibidem.

"Re-introduce" in the sense of putting back in the busybox less some of the functions it removed from the real less. I don't think those functions mentioned above were ever in the busybox less.

The difference can be illustrated by the size of the --help :
if I remember correctly : busybox less -> 4 lines
the real less -> 4 pages.

In my mind, it's clear that the busybox less is mis-representing the real less. Is there a doc telling the user what functions busybox has removed from the utilities it is supposed to replace? If not...

BTW, if you look in the /bin directory, you'll see quite a few busybox functions that BK himself has marked as "BB-NOT-USED". And he then provided the real program or a suitable replacement.

The problem here is that the user is not made aware of what (s)he is missing. If I had not searched the Internet, I would still not know all the possibilities of the real less. But not all users are as persistent.

You never know when you will need the full version of the utility replaced by a busybox "applet".

Best regards.

musher0
Standard Busybox policy (documented somewhere-I-forget-where-it-was ;) ) is to implement what is needed for scripts to work; SUSv3 conformance is not essential (especially when it's obscure options that aren't used anywhere...), but is considered desireable.

It is designed primarily as a scripting environment, but one that happens to be quite functional if you need to login to some embedded device.
That "embedded device" is a key part of the design process though. If busybox included every option of all the commands implemented, it would likely be a 20MB binary instead of 1-2 MB, and it would take half an hour to build instead of a couple minutes... And if that were the case, there would be many areas where busybox would fall out of use due to bloat. And we'd get stuck with even crappier alternatives.

But I'd like to ask you one question: when was the last time you needed
!<command> in less? I could see the reason if it were vi you were talking about, but have never desired that in a pager.

Posted: Wed 05 Jun 2013, 22:00
by musher0
Hi, Ibidem.

Ibidem wrote:
> But I'd like to ask you one question: when was the last time you needed
!<command> in less? I could see the reason if it were vi you were
talking about, but have never desired that in a pager.


Oh! I find quite handy. I use it a lot. It saves me the trouble of going
back to the menu or to a desktop icon to launch urxvt, for example, or
a script, or any other program. I now use it even to see what drives
are mounted and for access to them (see attached pic).

What I find particularly interesting in the full less is that it can act a real
reader (its main purpose). Through proper setting of its variables, it can
launch an editor (say, geany, or joe) if you need to edit anything.

I have made it my "defaulttextviewer"; it's much faster than the current
practice in Puppy, of using leafpad or nicoedit as the viewer. Also, since
you can't edit anything in less, while reading the text, you can't introduce
accidental errors if you press a wrong key.

Other uses:
You can team it up with cal to see a month or a year (see pic 2, and
code below)

Use less instead of gtk-dialog or yaf-splash; if you use the transparent
effect (-tr, -tint, and/or -sh parameters) in urxvt, it makes for a more
visually interesting message.

Highlight important words in a text you're sending to friends, members
or subscribers.

Etc., etc.

Thanks for reading this. BFN.

musher0

~~~~~~~~~~~~~~
Example: Script to view previous, current, or next year in less.

Code: Select all

#!/bin/ash
# $BINS/annee.sh
#
# annee, sans paramètre ou avec le paramètre 0, donne 
#	le calendrier de l'annee courante;
# annee +, celui de l'année suivante;
# annee -, celui de l'année précédente.
#
#(c) musher0, June 5, 2013.
####
a="`date +\"%Y\"`"
case $@ in
	+) an="`expr $a + 1`" ;;
	-) an="`expr $a - 1`" ;;
	0|*) an=$a ;;
esac
cal -s $an > /tmp/$an
AN="`head -n 1 /tmp/$an`"
GM="g 66x36+280+280"
urxvt -fn "xft:Proc2:pixelsize=12:autohint=true" +sb -$GM -tr -e less -L -j 36 -~ -P "$AN" /tmp/$an
rm /tmp/$an
Console usage (translated):
annee.sh 0 -> calendar of current year
annee.sh + -> ... of next year
annee.sh - -> ... of previous year

You can integrate the above directly in a pekwm, icewm or aewm
menu. Or you can create *.desktop files for the three possibilities for
other wm's. Or link to an icon on your desktop.

Note. The proportional Proc2 font is used here on purpose to create
the "wider" effect. Usually, for ease of reading, you'd use a "mono"
font (e.g., Monaco or Liberation Mono) with urxvt/less.

Posted: Wed 05 Jun 2013, 23:07
by scsijon
I sugest that you have a look at toybox and see what they have needed to added in there to extend busybox's functions.

Posted: Thu 06 Jun 2013, 06:46
by Ibidem
scsijon wrote:I sugest that you have a look at toybox and see what they have needed to added in there to extend busybox's functions.
Current toybox implements these commands (with expr find ifconfig mdev xzcat being partially implemented; toysh might work by chance on some platforms) :

Code: Select all

$ ./toybox 
basename bzcat cal cat catv chgrp chmod chown chroot chvt cksum clear 
cmp comm count cp cut date df dirname dmesg dos2unix du echo env expand 
expr false find free groups head help hostname id ifconfig insmod 
kill killall link ln login logname losetup ls lsmod lsusb md5sum mdev 
mkdir mkfifo mknod mkswap mktemp modinfo mountpoint nc netcat nice 
nohup od oneit passwd patch pidof printenv pwd readahead readlink 
realpath rev rm rmdir rmmod seq setsid sha1sum sleep sort stat swapoff 
swapon switch_root sync tac tail taskset tee time touch true truncate 
tty uname uniq unix2dos unlink unshare uptime usleep uudecode uuencode 
vconfig vmstat w wc which who whoami xargs xzcat yes 
(I'm the one who prepared xzcat.)
As you can see, there's a lot of work left to do...
Which is why Rob Landley is putting together an indiegogo project to fund work on it.
The main objective for toybox is ostensibly to provide a POSIX cli mcb that takes care of whatever a self-hosting Android needs. But Rob has a good bit more on the agenda, per his notes (basically, toybox should eventually replace all the minor collections of CLI tools, like busybox nash s6...besides being enough to build LFS.)
See http://landley.net/code/toybox/roadmap.html for more details on that score.
Currently the toybox license is pretty much PD.

The ones that are lacking for boot: grep (maybe sed awk tr), mount (beware! this should be ~600 lines; Rob got a 1400 line submission that he has not merged yet)

route is needed for networking, and a dhcp client also.

Posted: Fri 07 Jun 2013, 02:02
by scsijon
thank you ibidem,

I was was leading to the idea that maybe we should add toybox to our 'standard puppy' like aborigonal and others have done to extend some commands without having to use the 'full' command due to lack of functionality with the current busybox's version of a command. It may even allow us to remove some of the full commands we use now.

Alternately, the busybox group maybe need to revisit it's command set and extend a number of them with what users actually now need to have.

My apologies technosaurus for taking your ropic off-topic.

regards to all

Posted: Sat 08 Jun 2013, 05:42
by Ibidem
scsijon wrote:thank you ibidem,

I was was leading to the idea that maybe we should add toybox to our 'standard puppy' like aborigonal and others have done to extend some commands without having to use the 'full' command due to lack of functionality with the current busybox's version of a command. It may even allow us to remove some of the full commands we use now.

Alternately, the busybox group maybe need to revisit it's command set and extend a number of them with what users actually now need to have.

My apologies technosaurus for taking your ropic off-topic.

regards to all
What are the BB-NOTUSED applets? Currently on Debian, and I also use a pure busybox system (ie busybox, no gnu coreutils, no fileutils, no utils-linux, no extra text editor, no gnu sed, no gawk, ...), so I can't check atm.

Posted: Sat 08 Jun 2013, 15:01
by Karl Godt
bash-3.00#

Code: Select all

for i in /bin /sbin /usr/bin /usr/sbin ; do find $i -type l -iname "*notused"; done
/bin/cp-BB-NOTUSED
/bin/rm-BB-NOTUSED
/bin/sh-BB-NOTUSED
/bin/uname-BB-NOTUSED
/bin/cat-BB-NOTUSED
/bin/mount-BB-NOTUSED
/bin/chmod-BB-NOTUSED
/bin/ps-BB-NOTUSED
/bin/ln-BB-NOTUSED
/bin/head-BB-NOTUSED
/bin/ls-BB-NOTUSED
/bin/df-BB-NOTUSED
/bin/stat-BB-NOTUSED
/bin/dd-BB-NOTUSED
/bin/umount-BB-NOTUSED
/bin/touch-BB-NOTUSED
/bin/sleep-BB-NOTUSED
/bin/mv-BB-NOTUSED
/bin/rmdir-BB-NOTUSED
/bin/xargs-BB-NOTUSED
/sbin/insmod-BB-NOTUSED
/sbin/reboot-BB-NOTUSED
/sbin/mkswap-BB-NOTUSED
/sbin/man-BB-NOTUSED
/sbin/hwclock-BB-NOTUSED
/sbin/lsmod-BB-NOTUSED
/sbin/modprobe-BB-NOTUSED
/sbin/rmmod-BB-NOTUSED
/sbin/fdisk-BB-NOTUSED
/sbin/poweroff-BB-NOTUSED
/usr/bin/find-BB-NOTUSED
/usr/bin/cut-BB-NOTUSED
/usr/bin/uniq-BB-NOTUSED
/usr/bin/sort-BB-NOTUSED
/usr/bin/od-BB-NOTUSED
/usr/bin/head-BB-NOTUSED
/usr/bin/du-BB-NOTUSED
/usr/bin/xargs-BB-NOTUSED
/usr/bin/tac-BB-NOTUSED
/usr/bin/cmp-BB-NOTUSED
/usr/sbin/setfont-BB-NOTUSED
bash-3.00#

Posted: Sat 08 Jun 2013, 15:04
by Karl Godt
Am a fan of busybox modprobe , its missing the -D --show-depends option i think . I hate modprobe[-FULL] !

Some are scripts to adjust vars ie reboot, poweroff, df , calling busybox applets in them .

Posted: Sat 08 Jun 2013, 15:39
by Ibidem
Karl Godt wrote:Am a fan of busybox modprobe , its missing the -D --show-depends option i think . I hate modprobe[-FULL] !

Some are scripts to adjust vars ie reboot, poweroff, df , calling busybox applets in them .
(bb=busybox)
bb modprobe (without "simplified modutils") has -D since at least 1.20.2.
...Does Barry disable "simplified modutils" ?

sh I can see the reason for.
man is replaced with a script + browser (not my own preference, but...)
lsmod I see no logic to: neither bb nor standard has any options.
similar with sleep;
for rmdir bb lacks "--verbose".
for head bb lacks long options and metric units.
...

Posted: Sat 08 Jun 2013, 20:12
by sunburnt
As I understand it... Puppy`s BusyBox isn`t compiled for Puppy.
So Barry disables the BusyBox links and uses the exec. files instead.

BusyBox could be built with the full exec. files instead of the trimmed down ones.
And probably many other apps. could be included; file browser, media player, etc.