Linux Commands In Perl

73 views
Skip to first unread message

deech

unread,
Aug 17, 2012, 6:26:57 PM8/17/12
to stl...@googlegroups.com
Some one re-wrote a lot of the Linux commands in Perl: http://perllinux.sourceforge.net/. Thought I'd post in case some one hadn't seen it.

-deech

Don Ellis

unread,
Aug 18, 2012, 6:38:13 PM8/18/12
to stl...@googlegroups.com
Interesting!

One little hitch - you first need to implement UML. Instructions for
UML look pretty simple, but it just isn't working for me [yet]. As I
write this, I've tried running the 2.6.39 kernel and given up, and now
I'm trying 3.5.2. Hopefully the fact that I'm complaining will result
in success with my second kernel attempt. [Fail!]

Well, that's different. Instead of hanging, the attempted run aborted.

Here's the end of the run output, which is just about identical to the
results of v2.6.39, except that v2.6.39 hanged. And now, when I go
back to v2.6.39, I get a segfault instead of a hang. Original results
from 2.6.39 have scrolled out of the window. Need to tee these, or use
script (or some such).

[Note that in these two attempts, v2.6.39 shows 'parse_chan_pair
failed', while v3.5.2 shows 'setup_one_line failed', both for values
of 1-15]

= = = = = = = = = =
Results in v2.6.39 after trying v3.5.2
= = = = = = = = = =
Using a channel type which is configured out of UML
parse_chan_pair failed for device 15 : Configuration failed
Console initialized on /dev/tty0
console [tty0] enabled
VFS: Mounted root (hostfs filesystem) on device 0:8.
Segmentation fault

= = = = = = = = = =
Results in v3.5.2
= = = = = = = = = =
...
Initialized stdio console driver
Using a channel type which is configured out of UML
setup_one_line failed for device 1 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 2 : Configuration failed

...

Using a channel type which is configured out of UML
setup_one_line failed for device 14 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 15 : Configuration failed
Console initialized on /dev/tty0
console [tty0] enabled
VFS: Mounted root (hostfs filesystem) on device 0:8.
Aborted

= = = = = = = = = =

Don Ellis

unread,
Aug 18, 2012, 7:01:10 PM8/18/12
to stl...@googlegroups.com
One further note: when running this in v2.6.39, the system hangs after
the 15th parse_chan_pair failed message.

To get this far, I tried a later command line version:

./linux rootfstype=hostfs rootflags=/home/donls/uml/ rw mem=48M
init=/bin/bash TERM=linux PATH=/tools/bin:/bin quiet

Previous command line attempts were:

./linux rootfstype=hostfs rw init=/bin/bash

All of this is based on instructions for UML (required for perllinux) at:

landley.net/code/UML.html

Some of the instructions are just a bit sketchy, or aren't working for
me on Ubuntu 10.0.4.

--Don Ellis

Don Ellis

unread,
Aug 19, 2012, 5:16:51 PM8/19/12
to stl...@googlegroups.com
Ok, I've tried another page:

http://uml.devloop.org.uk/howto.html

Much more successful. Actually got the kernel (pre-built) to run in
UML mode. Couldn't get it to run right with their Debian-Wheezy
filesystem (got it to run, but lots of extra debugging info on
terminal), but worked great with their CentOS.

Then, I went to build perllinux to run on their kernel.

1) Term-Screen and Perl-Tidy are enumerated in the Makefile and import
lists with specific version numbers. I was able to find where they
were mentioned and fix this.

After I got those fixed, 'make get-required-imports' worked, but 'make
build-required' croaks with complaint about wrong kernel version.

I'll get back to it sometime, but just a bit too much trouble just now...

--Don Ellis

Jay Truesdale

unread,
Aug 19, 2012, 6:55:13 PM8/19/12
to stl...@googlegroups.com
What's the point of rewriting system commands in Perl instead of blazin' fast C?


--
You received this message because you are subscribed to the Google Groups "St. Louis Perl Mongers" group.
To post to this group, send email to stl...@googlegroups.com.
To unsubscribe from this group, send email to stl-pm+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/stl-pm?hl=en.


Don Ellis

unread,
Aug 19, 2012, 8:15:03 PM8/19/12
to stl...@googlegroups.com
Because we can!

[If they can find a way to precompile the commands, they could be
pretty darn fast too.]

Michael Kiwala

unread,
Aug 20, 2012, 9:30:00 AM8/20/12
to stl...@googlegroups.com
Perl runs on many platforms besides *nix. If these command are
written with portability in mind, you could now have your favorite
*nix commands available everywhere Perl runs.

John Osborne

unread,
Aug 20, 2012, 9:49:03 AM8/20/12
to stl...@googlegroups.com

How different is this from the perl power tools from years ago?

On Aug 17, 2012 5:27 PM, "deech" <aditya...@gmail.com> wrote:
Some one re-wrote a lot of the Linux commands in Perl: http://perllinux.sourceforge.net/. Thought I'd post in case some one hadn't seen it.

-deech

--
You received this message because you are subscribed to the Google Groups "St. Louis Perl Mongers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/stl-pm/-/ckptJ-yGVZoJ.

Steven Lembark

unread,
Aug 21, 2012, 6:26:15 AM8/21/12
to stl...@googlegroups.com, lem...@wrkhors.com
On Sun, 19 Aug 2012 17:55:13 -0500
Jay Truesdale <jtrue...@gmail.com> wrote:

> What's the point of rewriting system commands in Perl instead of blazin'
> fast C?

Roughly 1/10 the code; simpler error checkig via
exceptions; simpler processing of returned text using
scalars (vs. zero-terminated strings and strncomp), fewer
chances for buffer overruns without malloc, pre-allocated
buffers, strncpy, and friends; avoidance of memory
management in general and sbrk in particular, remembering
to use free, inter-platform compatability without having
to worry about statically linked binaries, not having to
deal with separate compiler and linker, not having to deal
with local object library collections, simpler testing,
documentation via POD...

and the fact that Perl and C block at the same speed, making
most of the commands run at roughly the same real speed.

See also: Lies, Damn Lies, & Benchmarks (2):

<http://www.slideshare.net/lembark/lies-damn-lies-and-benchmarks-part-2>


--
Steven Lembark 3646 Flora Pl
Workhorse Computing St Louis, MO 63110
lem...@wrkhors.com +1 888 359 3508

Guohui Yao

unread,
Aug 21, 2012, 11:47:46 AM8/21/12
to stl...@googlegroups.com
You are talking about programming ease of perl, but as a user I more
care about the performance of these commands. Can we users benefit?
Reply all
Reply to author
Forward
0 new messages