80x24.org misc. Free Software, open data formats/protocols discussion
 help / Atom feed
* why I prefer scripting languages
@ 2014-09-14 22:36 Eric Wong
  0 siblings, 0 replies; 1+ messages in thread
From: Eric Wong @ 2014-09-14 22:36 UTC (permalink / raw)
  To: misc

(totally genericized version because I've done the same thing
 countless times)

Last night I encountered a weird (and annoying) warning message from a
script I run occasionally.  Said warning message was kind enough to tell
me which file it was from, and it was not from the main script itself,
but one of the libraries (also a script) it was using.

I decided I wanted to prevent the main script from triggering the
warning in the library script.  Fortunately, I happen to be the
administrator of the machine I was running on, so I:

	1) opened the library script in my $EDITOR (requiring sudo)

	2) find the offending warning message in the library script

	3) lightly-edited the library script to dump a backtrace
	   before the warning message, this is a one or two-liner[1]

	4) rerun my main script to trigger the backtrace, and
	   note how the main script triggered it

	5) workaround the warning fix the bug in the main script

	6) undo my edits (made as root) to the library script

	7) send resulting the fix in the original script to the
	   maintainer(s)

The whole process took less than a minute and I never left the
original terminal I was working on.  No waiting for any source
code to download, no waiting for building or linking, etc.

Had I been using a compiled language, I would've done the same thing.
However, it would've taken longer to download all the required
components, wait for things to build, install the temporary package[2]

So yes, keep your software easy for ordinary users to hack on.


[1] in Perl: use Carp qw(cluck); cluck("warning here!")
    in Ruby: warn caller.join("\n")
    # sorry, haven't touched Python in over a decade,
    # comments greatly appreciated

[2] That said, Debian GNU/Linux (my distro of choice)
    makes it easy (but still potentially time consuming) with:

	# install build-dependencies as root
	sudo apt-get build-dep $PACKAGE

	# download the source to $PWD (no need for root)
	apt-get source $PACKAGE

	cd $SRCDIR # the above command will tell you $SRCDIR

	# make edits (no need to be root)
	$EDITOR /path/to/file/with/warning/message

	# compile + link the package
	debian/rules build

	# package it up as .deb files
	fakeroot debian/rules binary

	# install resulting debs
	sudo dpkg -i $NEW_DEBS # the above command will tell you names

^ permalink raw reply	[flat|threaded] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-14 22:36 why I prefer scripting languages Eric Wong

80x24.org misc. Free Software, open data formats/protocols discussion

Archives are clonable:
	git clone --mirror https://80x24.org/misc
	git clone --mirror http://ou63pmih66umazou.onion/misc

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.org.80x24.misc
	nntp://ou63pmih66umazou.onion/inbox.org.80x24.misc

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox