Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 09:40
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Puppy In-House Development
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 20 of 25 [374 Posts]   Goto page: Previous 1, 2, 3, ..., 18, 19, 20, 21, 22, 23, 24, 25 Next
Author Message
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Fri 01 Aug 2014, 02:56    Post subject:  

greengeek wrote:
Ibidem wrote:
But it does not have any tools for configuration, especially for setting up the first wpa_supplicant.conf. If someone wants to write one, I'd appreciate it...as long as they don't add too much bloat. .

Is that one of the configuration functions provided by rcrsn51's peasywifi? It seems a simple front end that worked well for me.

Yes it is, but...to go with wpanet I'm looking for a tool that isn't going to try killing the wpa_supplicant process wpanet starts, starting wpa_supplicant itself without wpa_cli, using both gtkdialog3 and xdialog at the same time, while hard-coding the usage of a specific dhcp client that doesn't come with Busybox, and so on.
I'm sure it works for most purposes, but the backend is exactly what wpanet is about avoiding, the frontend is inextricably combined with the backend, and I figure that one *dialog is enough for what I want to do but I'd like to have a good range of systems the config tool can run on.
Support for gtk+1.2-only systems (gtkdialog1/xdialog) and plain textmode (select/dialog) is important.
[Edit]I wrote wpanet after I saw a dhcp client panic my kernel because it started at the wrong time while the wireless was not connected (kernel 2.6.32, Ubuntu 10.04, madwifi-hal-0.10.5.6). So I'm not using or recommending something that starts wpa_supplicant but doesn't use a wpa_cli action script to control the dhcp client.
[/Edit]

I was thinking of something that would use xdialog or dialog based on runtime detection of what's installed and working, that would _only_ deal with configuration, and that could coexist with any wpa_supplicant service that supports wpa_cli.
I have a skeleton of a prototype already; it uses dialog so making it use xdialog would be easy.
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Sat 02 Aug 2014, 18:44    Post subject: wpa_config, first public revision  

I've written a first pass at a wpa_config tool.
Note: this is intended for configuring wpa_supplicant, with a couple convenient extensions thrown in. It is not a network manager, though for the purpose of wireless networks it fills most of what I need.
I've tested it lightly using dialog; in theory, it should also work with Xdialog or whiptail.
To use another dialog, you would need to add a line setting DIALOG.
gdialog or zenity will not work, due to being barely compatible with ancient versions of dialog.
kdialog might or might not work; reports appreciated.
The "help" text at the top may not be very intelligeable to someone who isn't ready to configure wpa-supplicant with their text editor; if you can think of better wording or find it unclear, please comment.
Connecting to hidden networks is almost certainly broken and unsupported; I have none to test on.
If someone who has hidden networks in their area could run this:
Code:
wpa_cli scan
wpa_cli scan_results >wpascanresults.txt

and provide the contents of wpascanresults.txt, that would be helpful.
If desired, I can make it only show wireless interfaces by default.
Code:
#!/bin/sh
#
# wpa_config script by Isaac Dunham
# written and released into public domain under CC0 in 2014
#
# I expressly disclaim ANY WARANTEE IMPLIED OR STATED, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARANTEES OF MERCHANTABILITY OR
# FITNESS FOR A PARTICULAR PURPOSE.
#
# wpa_config aims to be a dialog-based script for configuring wpa_supplicant
# with some aspects of a network manager thrown in.
# However, it stops short at starting/stopping/restarting wpa_supplicant
# itself; we leave that to system services.

mkdir -m 0700 -p /tmp/wpaconf || rm /tmp/wpaconf &&\
mkdir -m 0700 -p /tmp/wpaconf || {
   echo "Cannot obtain private tempdir!"
   exit 1
}

#DIALOG must implement:
# --insecure --output-fd --passwordbox --menu --inputbox --msgbox --fselect
# --insecure means "show asterisks"; I figure most people want that much acknowledgement.
# --fselect support is only needed for a couple features (user specified config files)

test -n "$DISPLAY" && DIALOG=`command -v Xdialog`
test -z "$DIALOG" && DIALOG=`command -v dialog`
# Unfortunately I have to live with whiptail...
test -z "$DIALOG" && DIALOG=`command -v whiptail`

newconf(){
echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=0" >$NEWCF
}

loadconfig(){
true >$CTRL
LOADCONFS="`[ -e /etc/wpa_supplicant/wpa_supplicant.conf ] && echo global /etc/wpa_supplicant/wpa_supplicant.conf`"
LOADCONFS="$LOADCONFS `[ -e /etc/wpa/$IFCUR.conf ] && echo local /etc/wpa/$IFCUR.conf`"
$DIALOG --output-fd 3 --menu "Which config file do you want to load?" 0 0 0 \
   $LOADCONFS other "browse for file" new "no file" 3>$CTRL
read conf <$CTRL
case $conf in
   new)   newconf
   ;;
   global)   cat /etc/wpa_supplicant/wpa_supplicant.conf >$NEWCF
   ;;
   local)   cat /etc/wpa/$IFCUR.conf >$NEWCF
   ;;
   other)   true >$CTRL
      $DIALOG --output-fd 3 --fselect /etc 20 60 3>$CTRL
      read conf <$CTRL
      case "$conf" in
         *.conf)   true >$NEWCF
            grep ^ctrl_interface "$conf" >/dev/null || newconf
            cat "$conf" >>$NEWCF
         ;;
         *)   $DIALOG --msgbox "No valid config file specified!" 0 0
         ;;
      esac
   ;;
esac
}

saveconfig(){
true >$CTRL
$DIALOG --output-fd 3 --menu \
"Choose a config file to write. WARNING! This WILL IMMEDIATELY OVERWRITE the file!" 0 0 0 \
    global /etc/wpa_supplicant/wpa_supplicant.conf \
    local /etc/wpa/$IFCUR.conf other "browse for file" 3>$CTRL
read conf <$CTRL
case $conf in
   global)   cat $NEWCF >/etc/wpa_supplicant/wpa_supplicant.conf
   ;;
   local)   cat $NEWCF >/etc/wpa/$IFCUR.conf
   ;;
   other)   true >$CTRL
      $DIALOG --output-fd 3 --fselect /etc 20 60 3>$CTRL
      read conf <$CTRL
      case "$conf" in
         *.conf)   cat $NEWCF >"$conf"
         ;;
         *)   $DIALOG --msgbox "No valid config file specified!" 0 0
         ;;
      esac
   ;;
esac
}


setif(){
true >$CTRL
$DIALOG --output-fd 3 --menu "Select an interface:" 0 0 0 `ls /sys/class/net |sed -e 's/^\(.*\)$/\1 \1/g'` 3>$CTRL
read net <$CTRL
export IFCUR=${net:-$IFCUR}
unset net
}

net_add_open() {
true >$CTRL
test -z "$1" && $DIALOG --output-fd 3 --inputbox "Enter the SSID you wish to connect to.\nIf you enter 'any', the computer will\nconnect to any open network." 0 0 any 3>$CTRL
read net <$CTRL
test -n "$1" && net=$1
test -n "$net" || return
echo "network={" >> $NEWCF
case $net in
   any) ;;
   *) echo '   ssid="'"$net"'"' >>$NEWCF
   ;;
esac
echo '   key_mgmt=NONE' >>$NEWCF
echo '}' >>$NEWCF
}

net_add_wep(){
true >$CTRL
$DIALOG --output-fd 3  --insecure --passwordbox "Enter the WEP key for SSID: $1"  0 0 3>$CTRL
test `wc -c <$CTRL` -gt 0 || return
cat >>$NEWCF <<EOF
network={
   ssid="$1"
   key_mgmt=IEEE8021X
   eap=MD5
   wep_key0=`cat $CTRL`
}
EOF
echo done >$CTRL
}

net_add_wpa() {
true >$CTRL
$DIALOG --output-fd 3  --insecure --passwordbox "Enter the passphrase for SSID: $1"  0 0 3>$CTRL
test `wc -c <$CTRL` -gt 0 || return
wpa_passphrase $1 <$CTRL >>$NEWCF
echo done >$CTRL
}

network_add() {
true >$CTRL
$DIALOG --output-fd 3 --inputbox "Enter the SSID you wish to connect to." 0 0 3>$CTRL
read net <$CTRL
test -n "$net" || return
true >$CTRL
$DIALOG --output-fd 3 --menu "Choose the network encryption:" 0 0 0 \
   No encryption WEP encryption WPA encryption 3>$CTRL || return
case `cat $CTRL` in
   No)   net_add_open $net
   ;;
   WEP)   net_add_wep $net
   ;;
   WPA)   net_add_wpa $net
   ;;
esac
}

#scanner:
# scan
# save results to file
# parse from file
#Buttons:
#Refresh/Add/Leave
# Usage: IFCUR=if0 scanner
scanner() (
if test OK != "`wpa_cli -i "$IFCUR" scan `"
  then
    $DIALOG --msgbox "wpa_cll status for $IFCUR failed!" 0 0
    return
  fi
net=Rescan
while test -n "$net"
do
  case $net in
    Rescan)
      SCAN=`mktemp /tmp/wpaconf/scanXXXXXX`
      SCAN2=`mktemp /tmp/wpaconf/scanXXXXXX`
      wpa_cli -i "$IFCUR" scan_results >$SCAN

      echo '$DIALOG --output-fd 3 --menu "Select a network to connect to, or rescan." 0 0 0 \' >$SCAN2
      cat $SCAN |awk '{if (NF==5) print $1 "\t\""$5"\" \\";
                  else if (NF==4) print $1 "\t\"" $4"\" \\"; }' >>$SCAN2
      echo 'Rescan "for more networks" 3>$CTRL' >>$SCAN2
      true >$CTRL
      . $SCAN2
      read net <$CTRL
      ;;
    *:*:*:*)
      NET="`awk '{if ($1 == "'$net'") print $NF}' <$SCAN`"
      #network_add $NET
      case `awk '{if ($1 == "'$net'") if (NF == 5) print $4; else print "open"}' <$SCAN` in
         *WPA*PSK*) net_add_wpa $NET
   ;;
   *WEP*) net_add_wep $NET
   ;;
   open) net_add_open $NET
      esac
      net=Rescan
      ;;
   esac
done
rm -f $SCAN $SCAN2
)

#initialize before main loop
CTRL=`mktemp /tmp/wpaconf/ctrlXXXXXX`
cmd=maindummy
NEWCF=`mktemp /tmp/wpaconf/confXXXXXX`
newconf
setif
test -n "$IFCUR" || exit 1

#Now, main loop:
while test -n "$cmd"
   do   true >$CTRL
      exec 3>$CTRL
      $DIALOG --output-fd 3 --menu "Select an operation:" 0 0 0 \
        1 scan 2 disconnect 3 reassociate \
        4 "change interface ($IFCUR)" 5 "add network" \
        6 "load new config file" 7 "save config file" 8 "view config file"
      exec 3<&-
      read cmd <$CTRL
      case $cmd in
         1) scanner
         ;;
         2) wpa_cli -i $IFCUR disconnect
         ;;
         3) wpa_cli -i $IFCUR reassociate
         ;;
         4) setif
         ;;
         5) network_add
         ;;
         6) loadconfig
         ;;
         7) saveconfig
         ;;
         8) $DIALOG --scrollbar --textbox $NEWCF 0 0
         ;;
      esac
   done
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Wed 06 Aug 2014, 14:14    Post subject:  

It looks ok, except some bashisms:
command -v , can be removed if you don't have quoted args inside of args
if you need to run a program with a built list of args you can do this:
args="\"first arg\""
args="${args} \"second arg\""
#...
eval $MYCOMMAND "$args"

for open/wep wife, iw is the best tool I have come across (permissive license and well maintained)
http://wireless.kernel.org/en/users/Documentation/iw
built with libnl-tiny instead of the gpl'd netlink libs:
https://github.com/sabotage-linux/libnl-tiny

I have done a lot of further development on my MIME-type detector. All of the types are hard-coded but doing so gains a couple of orders of magnitude of speed over that _other_ tool (file + libmagic) by doing a binary search on inbuilt sorted values vs. a series of linear searches on xml-derived data. Feel free to mod it for your desktop environment or web server (its initial purpose was to quickly output the Content-type: ) It initially tries to guess the mime-type by file extension for speed (no file opening==no delay), then by magic@offset if not compiled with -DNO_MAGIC.
For a test program compile with:
gcc -DTEST -Os -fmerge-all-constants -fno-asynchronous-unwind-tables -fno-unwind-tables -o MIME3 MIME3.c -s
Available on Github

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Wed 06 Aug 2014, 23:12    Post subject:  

technosaurus wrote:
It looks ok, except some bashisms:
command -v , can be removed if you don't have quoted args inside of args
if you need to run a program with a built list of args you can do this:
Code:
args="\"first arg\""
args="${args} \"second arg\""
#...
eval $MYCOMMAND "$args"


command -v is POSIX not bash; it's the equivalent of which (which is a Linuxism).
The point there is:
Is there an executable for such-and-such dialog version?
It will return nothing if it's not found, the path if it is found.

Quote:
for open/wep wife, iw is the best tool I have come across (permissive license and well maintained)
http://wireless.kernel.org/en/users/Documentation/iw
built with libnl-tiny instead of the gpl'd netlink libs:
https://github.com/sabotage-linux/libnl-tiny

First, libnl-tiny is originally an OpenWRT project, consisting simply of a partial fork of libnl 2.
As such, it is under the exact same license: LGPL 2.1.
libnl 3 is under LGPL 2.1 as well.
By the way, I'd like to say that libnl has a pretty responsive upstream; when I sent them a patch to make it work with musl (back in the early 0.9.x timeframe), I got a "thanks, applied" the next day.

Second, iw is not compatible with wext. This means it's out unless you have a recent kernel and in-kernel drivers.

Third, using iw is not going to simplify things.
wpa_config is intended to configure wpa_supplicant to connect to any network you want; wpa_supplicant is what I'm using because it's persistent, it supports all types of wireless networks, it's permissively licensed (BSD-style), and adding a persistent network doesn't take writing a script that you have to run at boot/manually, with a hacked-up parser to figure out whether you even can find the network you want, a case statement that really has to be modified manually if you want to handle roaming, and perhaps another hacked up parser to figure out if you've connected, plus the logic to start a dhcp client.

(That's what it takes to use iw/iwconfig properly, though if you only have one network you ever use and don't have any concerns about kernel panics you could set things up in two lines.)

When I was at the university, I had to have two wireless networks: one for home, one for school. The one at home was wpa, while school had an open network.
wpa_supplicant can connect to the right one automatically, with just this much configuration:
Code:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=network
network={
   ssid="school"
   key_mgmt=NONE
}
#autogenerated by wpa_passphrase wpa password
network={
   ssid="wpa"
   #psk="password"
   psk=3d2e41dbc74080cdb861baf815d70488312e6581b64f44bb2785db5c5a2f27bd
}

It's simpler to handle the errors and it works better (roaming, persistence, reassociation after dropped connections), so I want to make it even easier to use.

Quote:
I have done a lot of further development on my MIME-type detector. All of the types are hard-coded but doing so gains a couple of orders of magnitude of speed over that _other_ tool (file + libmagic) by doing a binary search on inbuilt sorted values vs. a series of linear searches on xml-derived data. Feel free to mod it for your desktop environment or web server (its initial purpose was to quickly output the Content-type: ) It initially tries to guess the mime-type by file extension for speed (no file opening==no delay), then by magic@offset if not compiled with -DNO_MAGIC.
For a test program compile with:
gcc -DTEST -Os -fmerge-all-constants -fno-asynchronous-unwind-tables -fno-unwind-tables -o MIME3 MIME3.c -s
Available on Github

Neat.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Thu 07 Aug 2014, 02:07    Post subject:  

Turns out the bashism checker i used had a bug report filed stating as such:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733511

I think Iguleder is using a ksh derivative (loksh) until toysh is complete

libnl-tiny seems to have lost the license file, I noticed the lgpl reference after the post in a random file, so unless it has a static linking exception that eliminates iw.
I had it in my mind that wpa_sup could't do wep, but just noticed /usr/share/doc/wpasupplicant/examples/wep.conf ... so disregard ... though openBSD's ifconfig seems workable too.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Thu 07 Aug 2014, 03:45    Post subject:  

technosaurus wrote:
Turns out the bashism checker i used had a bug report filed stating as such:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733511

I think Iguleder is using a ksh derivative (loksh) until toysh is complete

libnl-tiny seems to have lost the license file, I noticed the lgpl reference after the post in a random file, so unless it has a static linking exception that eliminates iw.
I had it in my mind that wpa_sup could't do wep, but just noticed /usr/share/doc/wpasupplicant/examples/wep.conf ... so disregard ... though openBSD's ifconfig seems workable too.


loksh is openbsd pdksh, with s/\(str\)l\(c[ap][ty]\)/\1n\2/ being the main change besides disabling suspend and mknod builtins.

To be precise, using strn* like strl* is an off-by-one error; also, musl provides the strl* functions. I use the slack-builds patches for openbsd-ksh with -lbsd removed.

As far as WEP goes, you can look at my script. I've used wpa_supplicant with open, wep, and wpa.

wpa_supplicant can be built with no external dependencies; it needs a crypto library, with openssl, gnutls, or an internal one based on tomcrypt being the three options. (You can disable crypto, but that's nearly useless.)
wext is adequate, though libnl/libnl-tiny can be used.
readline can be used, or internal line editing code (which is quite adequate).
dbus, pcap, and several other things are optional on Linux.

so, a permissively-licensed rootfs:
musl
(pd/openbsd-/lo/m)ksh
toybox (init, utils, ifconfig, route...)
wpa_supplicant
optional libarchive, xz, bzip, zlib
axtls/openssl
curl
tinyxlib, tinyxserver
term of the day (xterm or urxvt)
w3m (only mit-licensed browser, IIRC; there may be one other lightweight...but I can't build w3m)
nvi, One True AWK/mawk/heirloom nawk, nbsd sed
fltk, tcl/tk

ast license is compatible, but the code is not easy to get running.
dialog is lgpl, though ncurses is MIT. pdcurses is PD+MIT, bsd curses is BSD.
Back to top
View user's profile Send private message 
Iguleder


Joined: 11 Aug 2009
Posts: 1922
Location: Israel, somewhere in the beautiful desert

PostPosted: Thu 07 Aug 2014, 15:45    Post subject:  

Ibidem wrote:
technosaurus wrote:
I think Iguleder is using a ksh derivative (loksh) until toysh is complete


Nope - I use OpenBSD's ksh just because it's small, Bash-compatible (still haven't had a single incompatibility) and battle-tested. I don't see any reason to switch.

Ibidem wrote:

so, a permissively-licensed rootfs:
musl
(pd/openbsd-/lo/m)ksh
toybox (init, utils, ifconfig, route...)
wpa_supplicant
optional libarchive, xz, bzip, zlib
axtls/openssl
curl
tinyxlib, tinyxserver
term of the day (xterm or urxvt)
w3m (only mit-licensed browser, IIRC; there may be one other lightweight...but I can't build w3m)
nvi, One True AWK/mawk/heirloom nawk, nbsd sed
fltk, tcl/tk


Pretty close to DSLR's package selection, except OpenBSD's awk and FLTK (C++ - you'll need a STL) and tcl (what for?).

_________________
My homepage
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
ICQ Number 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Thu 07 Aug 2014, 17:38    Post subject:  

Iguleder wrote:
... and tcl (what for?).
tk is the only (formerly) widely used permissively licensed widget toolkit.

Alternatives:
1. tekui -http://tekui.neoscientists.org/ uses lua
- if you prefer javascript over lua, tekui could be ported to js using a bit of duktape
(literally see https://github.com/svaarala/duktape its built quite similar to lua)
2. nsfb based toolkit (http://git.netsurf-browser.org/libnsfb.git/tree/test/svgtiny.c) This would require some work but supports many backends includint linux fb, xcb and wayland - like a simplified version of SDL
3. <geek stuff> use only the framebuffer http://litcave.rudi.ir/ - the fbvis musl-static compiles down to 50kb if only stb_image is used (light patch required ~3 lines in fbvis.c and modify 1 line in the makefile) there are several other tools there too, but I didn't want to build ffmpeg at the time ... I wonder how hard it would be to port tinyX11 to use the framebuffer directly using memmaped files and a simple inotify blitter daemon in place of the xserver (wait that sounds like the v9fb/l9fb projects) ... again anything "new" we want to do was probably done 20+ yrs ago at bell labs
</geekstuff>

Re: C++ - I'm not opposed to including (just programming with) a lightweight STL like https://github.com/msharov/ustl which looks like it is very light and would be a nice complement to musl. The author has also done some good work with xcb (neat game ->https://github.com/msharov/gjid) and opengl (can build static binaries without Mesa and operate remotely https://github.com/msharov/gleri)
An STL is needed for many other lightweight tools, libstdc++ just makes them heavier than they should be.

Side note: I finally got my ultralight static libc working on 64bit (I didn't realize the syscall mappings are completely different - which is why the mount program failed before - it was actually calling access())

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Thu 07 Aug 2014, 18:33    Post subject:  

Iguleder wrote:
Ibidem wrote:
technosaurus wrote:
I think Iguleder is using a ksh derivative (loksh) until toysh is complete


Nope - I use OpenBSD's ksh just because it's small, Bash-compatible (still haven't had a single incompatibility) and battle-tested. I don't see any reason to switch.

Ibidem wrote:

so, a permissively-licensed rootfs:
musl
(pd/openbsd-/lo/m)ksh
toybox (init, utils, ifconfig, route...)
wpa_supplicant
optional libarchive, xz, bzip, zlib
axtls/openssl
curl
tinyxlib, tinyxserver
term of the day (xterm or urxvt)
w3m (only mit-licensed browser, IIRC; there may be one other lightweight...but I can't build w3m)
nvi, One True AWK/mawk/heirloom nawk, nbsd sed
fltk, tcl/tk


Pretty close to DSLR's package selection, except OpenBSD's awk and FLTK (C++ - you'll need a STL) and tcl (what for?).

Have you built w3m?

Speaking of loksh: when you replace strl* with strn*, you need to subtract one from the 'n' arg. strl* will copy no more than "as much as fits in a null-terminated string occupying an n byte array".
strn* will copy "as many chars as fit in an n byte array".
As a result, s/strl/strn/ causes breakage when you hit oversize strings: it won't overflow itself, but the new string will not be null-terminated. As a result, the next operation may read from an invalid address, overestimate the length, or otherwise break.
Also, if the return value of strl* is checked, there will be massive breakage: strn* returns an address, while strl* returns number of bytes.
musl included strl* because they make it easier to write safe programs.

Incompatabilities with bash do exist; I think shell arrays are one of them. (Try http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_10_02.html in loksh.) But most of the "bash features" people talk about were copied from one version of ksh or another. ksh93 (which I haven't managed to build...) has a number of features that aren't even available in bash, like floating-point shell math like $((7*7*3.14)).
mksh has copied several of them.

tcl is as a scripting language and a GUI toolkit (actually, tk is the latter part).
There are quite a few programs written using tk, and it's easy to write more.
Athena (Xaw) is also permissively licensed.
Speaking of which...I'm tempted to try a lua/tk or wish version of wpa_config. But that's probably rash at this point.

It seems OpenBSD awk is the One True AWK with several patches.
("One True AWK" is the latest release of awk from the original authors. It's (C) Lucent, under a BSD-like license.)
Back to top
View user's profile Send private message 
Iguleder


Joined: 11 Aug 2009
Posts: 1922
Location: Israel, somewhere in the beautiful desert

PostPosted: Fri 08 Aug 2014, 08:25    Post subject:  

Ibidem wrote:
Speaking of loksh: when you replace strl* with strn*, you need to subtract one from the 'n' arg. strl* will copy no more than "as much as fits in a null-terminated string occupying an n byte array".
strn* will copy "as many chars as fit in an n byte array".
As a result, s/strl/strn/ causes breakage when you hit oversize strings: it won't overflow itself, but the new string will not be null-terminated. As a result, the next operation may read from an invalid address, overestimate the length, or otherwise break.
Also, if the return value of strl* is checked, there will be massive breakage: strn* returns an address, while strl* returns number of bytes.
musl included strl* because they make it easier to write safe programs.


Thanks for the feedback! Fixed.

Ibidem wrote:
Incompatabilities with bash do exist


Of course, Bash always has more surprises up its sleeve. Still haven't encountered even a single incompatibility issue.

I used tcsh before I ported over OpenBSD's shell, but it was kinda big and felt "different". ksh feels like Bash or the Busybox ash.

Ibidem wrote:
tcl is as a scripting language and a GUI toolkit (actually, tk is the latter part).


What's so bad about GTK+ 1.x and GtkDialog1, except GPL?

_________________
My homepage
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
ICQ Number 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Fri 08 Aug 2014, 17:48    Post subject:  

Iguleder wrote:
Of course, Bash always has more surprises up its sleeve. Still haven't encountered even a single incompatibility issue.
...
What's so bad about GTK+ 1.x and GtkDialog1, except GPL?

Like bashdiff ... it (and the 3.x bash series) should really be a Puppy/Slitaz maintained project to replace gtkdialog, sqlite3 shell, hiawatha, and numerous other tools.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Sat 09 Aug 2014, 01:34    Post subject:  

Iguleder wrote:
Ibidem wrote:
Incompatabilities with bash do exist


Of course, Bash always has more surprises up its sleeve. Still haven't encountered even a single incompatibility issue.

I used tcsh before I ported over OpenBSD's shell, but it was kinda big and felt "different". ksh feels like Bash or the Busybox ash.

Agreed. (t)csh is a shell in function, but it's got little in common with the Bourne-like shells. And bash and the various ksh versions are the most closely related shells, syntax-wise.

History as far as I can tell: Bourne was ~first (barring some ancient versions that act very different), Korn wrote an "improved" version called ksh (or ksh88, since it was released in 1988), someone copied Bourne to make the first version of bash, someone started copying ksh to make pdksh, POSIX borrowed from ksh onto Bourne to make Posix sh, bash implemented that and kept borrowing from ksh, Korn wrote a bigger version with tons of features (called ksh93); bash and ksh have been borrowing from each other since, though most new stuff happens in ksh93 now; meanwhile, Almquist implemented a POSIX shell (ash), which got ported to Linux and eventually forked as dash. bash has borrowed a couple small details from csh (&> is the main one). zsh is a HUGE shell that aims to act like any and every other shell, with the ability to imitate bash, ksh, and csh, plus several extensions; but it's not without bugs.
Quote:
Ibidem wrote:
tcl is as a scripting language and a GUI toolkit (actually, tk is the latter part).


What's so bad about GTK+ 1.x and GtkDialog1, except GPL?

I was describing a permissively licensed rootfs; "except GPL" is plenty of reason for that, though I don't mind using GPL software. (It's sometimes fun to pick a semi-arbitrary limit and figure out what you can do within it.)
But there are a couple slightly more technical reasons than that.
gtkdialog1: just a TLA that rhymes with "hell": XML.
Having on occasion tried to edit XML config files by hand, I'm eager to stay as far away as possible. I'm certainly not excited about the prospect of writing and maintaining a program done in XML.

I rather like using gtk1 software, but gtk1 is not really all that widely distributed (and likewise for gtkdialog*); also, glib can get annoying.

Additionally, gtk and gtkdialog are much more verbose than Tcl/Tk. I'm afraid I can't give an example for this off the top of my head, though.

Completely off topic: I presume all the trouble we've been hearing about in the news is a fair distance from you?
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2224
Location: The Blue Marble

PostPosted: Sat 09 Aug 2014, 03:10    Post subject:  

Ibidem wrote:
I was describing a permissively licensed rootfs; "except GPL" is plenty of reason for that, though I don't mind using GPL software.


Another off-topic, but related to the license thing: I happen to be trying to build MariaDB (the offshot of what was originally MySQL).
And look at what the kind of FUD they put into CMakeList.txt:
MariaDB CMakeList.txt wrote:
IF(NON_DISTRIBUTABLE_WARNING)
MESSAGE(WARNING "
You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.")
ENDIF()

And this is from someone who made US$1billion from creating GPL software in the first place Evil or Very Mad (For those not in the know: MariaDB is created as a fork of MySQL. MariaDB is created by the very same person who created MySQL - he sold GPL-ed MySQL to Oracle for $1billion, was happy with the money but not happy that he no longer had any say in MySQL, so he created the MariaDB fork and has been woo-ing people to drop MySQL in favour of MariaDB - so that perhaps once its popular enough he can sell it again for the second time for another $1billion to IBM or Apple or Microsoft, this time).

It's one thing to disagree with GPL or GPLv3 or even its principles; it's another thing to tell blatant lies in a supposedly high-profile GPL-ed software like this Evil or Very Mad (and as I said - especially from someone who profited from it).

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
Iguleder


Joined: 11 Aug 2009
Posts: 1922
Location: Israel, somewhere in the beautiful desert

PostPosted: Sat 09 Aug 2014, 04:52    Post subject:  

Ibidem wrote:
Having on occasion tried to edit XML config files by hand, I'm eager to stay as far away as possible. I'm certainly not excited about the prospect of writing and maintaining a program done in XML.


Agreed, I hate XML too. Other formats (like JSON) make things just a little bit simpler, because they're cleaner (e.g you don't have to close tags).

Ibidem wrote:
I rather like using gtk1 software, but gtk1 is not really all that widely distributed (and likewise for gtkdialog*); also, glib can get annoying.


Yep, C++ imitations in C are horrible by definition.

Ibidem wrote:
Completely off topic: I presume all the trouble we've been hearing about in the news is a fair distance from you?


40 km from me, I hear and feel every rocket fired and every air strike.

jamesbond wrote:
And this is from someone who made US$1billion from creating GPL software in the first place Evil or Very Mad


Generally, I believe in "live and let live". I don't like the fact GPL is viral, so I license my own code under BSD (if it's useful for commercial projects - I get some reputation) or make it public domain (if it isn't).

However, GPL/BSD is not a consideration when I have to decide which packages should be included in a distro, unless it's an evil GPL project (e.g a project owned by a company, with a CLA).

_________________
My homepage
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
ICQ Number 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Sat 09 Aug 2014, 06:25    Post subject:  

Ibidem wrote:
Additionally, gtk and gtkdialog are much more verbose than Tcl/Tk. I'm afraid I can't give an example for this off the top of my head, though.

Biggest thing, NO SANE DEFAULTS
Quote:
Completely off topic: I presume all the trouble we've been hearing about in the news is a fair distance from you?

huh?, didn't see anything on slashdot, whats up?

... I am really starting to like tekui and lua. Lua isn't bad once you get used to it, but I still may port tekui to javascript with duktape since the interface already uses css and it can handle xml and json - if ported from lua to javascript, you've got a nice little web browser in 100+ lines of code.

jamesbond wrote:
It's one thing to disagree with GPL or GPLv3 or even its principles; it's another thing to tell blatant lies in a supposedly high-profile GPL-ed software like this Evil or Very Mad (and as I said - especially from someone who profited from it).
<rant>
Technically they are right. GPL2 is incompatible with GPL3, so if you link a GPL2 only library (without the "or any later version" clause), then you are violating the GPL. GPL3 demonstrated in one fell swoop how dangerous that clause can be. Manufacturers who had been contributing to GPL software and properly distributing the source could no longer use the new version because they had been installing it to ROM for cost and performance reasons (ROM which the end user could't possibly modify) ... That pretty much eliminated the embedded market and things have gone down hill from there. I mainly try to avoid using anything from the FSF or other entities with legal documents over 1 page because I don't have my own personal team of lawyers to help me comply (or figure out if it is even possible to comply ... can you even build GPL3 software against the linux kernel headers?).
</rant>

Re: shells
I think it would be nice to have something basic for common languages
python -> tinypy
tcl -> jim-tcl
js -> duktape/quadwheel/libsee/spidermonkey-1.8.0b1
lua -> stua (part of stb), luajit or even plain lua, its pretty small already
java -> avian
perl -> microperl
c -> tcc

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 20 of 25 [374 Posts]   Goto page: Previous 1, 2, 3, ..., 18, 19, 20, 21, 22, 23, 24, 25 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1918s ][ Queries: 13 (0.0099s) ][ GZIP on ]