BashDiff - Bash extended.

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

BashDiff - Bash extended.

#1 Post by rarsa »

Have a look at bashdiff http://freshmeat.net/projects/bashdiff/

I've complied it (I added a patch provided by William) and it works great in Puppy

It adds just about 10K to the original bash but greatly extends the power of bash scripting:

- String handling (strcat, strcpy, strlen, strcmp)
- Array handling
- XML parsing: (expat)
- error checking (try-block)
- Calculations (HP syle rpn calculator)
- GTK UI generation (Way better and cleaner than gtkdialog)
Plus many more features

Once I'm done readying XDG menus package and the network wizard for 1.0.9 I will prepare a package with it... or why wait, just because I'm at the office now and not in linux does not mean that I cannot upload it:
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

wow, looks promising.
I currently do some coding in C (Gtk), and think of releasing some widgets in the next days, that can be used in scripts.
Like that one for example:
http://dotpups.de/pics/puppy/dbsetter.jpg

So if someone has a special wish... :)
Mark

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#3 Post by BarryK »

Gee, that looks like my wish-list for Bash!

I'm downloading it right now!

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#4 Post by rarsa »

Hi Barry,

Yes, pretty impresive. The developer is member of my local LUG and as soon as he made a presentation I was hooked. I've been testing it since.

Please beware of the following email exchange with William:

I had to apply the patch manually (manually inserting the required lines) as the patch as is would not work for me.

Please also note that I disabled all the libraries that don't nativelly come on the LiveCD.
> I'm having a problem using it.
>
> The problem is that whenever I enter a command it
> cannot find, it tells me that, but does not return to
> the command line, I must close the console window.
>
> I've compiled bash+william according to William's page
> and using the following configure:
>
> ./configure --disable-postgresql --disable-mysql
> --disable-sqlite --disable-gdbm --disable-libwebserver
>
> It compiled OK, and I can use the new shell with the
> basic functionality.
>
> Have you experienced this problem?

It's not my doing. :-) Glibc is the culprit. You'll see the same
behaviour with the stock Bash, without my patch. It works here with
- gcc-3.3.6
- glibc-2.3.5

If you have older version, then here is patch which Slackware distro
applied...

Code: Select all

--- jobs.c.orig	2005-09-10 12:40:49.000000000 -0700
+++ jobs.c	2005-09-10 12:41:13.000000000 -0700
@@ -2476,6 +2476,7 @@
   PROCESS *child;
   pid_t pid;
   int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
+  static int wcontinued_not_supported = 0;
 
   call_set_current = children_exited = 0;
   last_stopped_job = NO_JOB;
@@ -2489,7 +2490,15 @@
 			: 0;
       if (sigchld || block == 0)
 	waitpid_flags |= WNOHANG;
+    retry:
+      if (wcontinued_not_supported)
+       waitpid_flags &= ~WCONTINUED;
       pid = WAITPID (-1, &status, waitpid_flags);
+      if (errno == EINVAL)
+       {
+         wcontinued_not_supported = 1;
+         goto retry;
+       }
 
       /* The check for WNOHANG is to make sure we decrement sigchld only
 	 if it was non-zero before we called waitpid. */
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#5 Post by rarsa »

Oh, I almost forget to mention.

The version I uploaded also has the following patch I sent to William. The code is so clean that It was a breeze to figure it out.

The patch is to allow images on the buttons by adding an "image" attribute to the <button> tag:

Code: Select all

==============================
--- gtk.orig.c  2006-04-11 00:32:57.000000000 -0500
+++ gtk.c       2006-04-11 00:21:13.000000000 -0500
@@ -749,6 +749,9 @@
            if (STREQ (a, "label")) {
                gtk_button_set_label (GTK_BUTTON (w),(gchar *)b);
            }
+           else if (STREQ (a, "image")) {
+               gtk_button_set_image (GTK_BUTTON (w),gtk_image_new_from_file((gchar *)b));
+           }
            else if (STREQ (a, "stock")) {
                gtk_button_set_label (GTK_BUTTON (w),(gchar *)b);
                gtk_button_set_use_stock (GTK_BUTTON(w), TRUE);
William has also identified the following bug
William Park wrote:> Thanks for the feedback!
>
> I just found a typo, which will result in segfault.
> Try
>
> ( a=123456789; echo ${a|>2}; )
>
> and you'll see either strange character at the end,
> or segmentation
> fault. It's returning unterminated string. Other
> than that, everything
> should work. :-)
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#6 Post by rarsa »

I talked to William Park and he was quite pleased that bashdiff is in Puppy.

He has some nice improvements planned for the next version.

On top of that, he already included my patch for the image buttons on the GTK extension.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
Nathan F
Posts: 1764
Joined: Wed 08 Jun 2005, 14:45
Location: Wadsworth, OH (occasionally home)
Contact:

#7 Post by Nathan F »

I can't believe it took me so long to look at this, this is great. Thanks again, Rarsa.

Nathan
Bring on the locusts ...

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#8 Post by rarsa »

Nathan,

Please notice that Puppy2 already comes with bash-diff as the default shell.

It does not enable the expat or gtk but it's easy to enable (no recompiling needed).
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#9 Post by BarryK »

rarsa,
A web page or wiki page "How to use Bash-diff in Puppy Linux"
would be great! :wink:

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#10 Post by rarsa »

I'll extract the relevant information form William's page.

I will basically remove anything unrelated to bash-diff and write the commands based on puppy's file structure.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
Nathan F
Posts: 1764
Joined: Wed 08 Jun 2005, 14:45
Location: Wadsworth, OH (occasionally home)
Contact:

#11 Post by Nathan F »

I'm experimenting with it now, the gtk features are just great. I'm thinking of a lot of uses for the XML functions, too.

Nathan
Bring on the locusts ...

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#12 Post by Lobster »

Wiki page created - relevant info to add? I will leave to you guys . . .
http://puppylinux.org/wikka/BashDiff
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#13 Post by rarsa »

BarryK wrote:rarsa,
A web page or wiki page "How to use Bash-diff in Puppy Linux"
would be great! :wink:
Barry,

I've cleaned William's bashdiff page removing the sections that had nothing to do with bash and modifying the commands to match Puppy's file organization.

It has excellent examples on how to use the added functionality.

It is now on the Puppy subversion repository on the following project:

http://svn2.cvsdude.com/puppylinux/pupp ... ages/trunk.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

Post Reply