Monday·12·October·2020
Git related shell aliases I commonly use //at 14:28 //by abe
Hope this might be an inspiration to use these or similar aliases as
well.
Tagged as: CLI, git, git-annex
// show without comments // write a comment
Related stories
Tuesday·22·April·2014
GNU Screen 4.2.0 in Debian Experimental //at 20:22 //by abe
About a month ago, on 20th of March, GNU Screen had its 27th anniversary.
A few days ago, Amadeusz Sławiński, GNU Screen’s new primary upstream maintainer, released the status quo of Screen development as version 4.2.0 (probably to distinguish it from all those 4.1.0 labeled development snapshots floating around in most Linux distributions nowadays).
I did something similar and uploaded the status quo of Debian’s screen package in git as 4.1.0~20120320gitdb59704-10 to Debian Sid shortly afterwards. That upload should hit Jessie soon, too, resolving the following two issues also in Testing:
- #740301: proper systemd support – Thanks Josh Triplett for his help!
- #735554: fix for multiuser usage – Thanks Martin von Wittich for spotting this issue!
That way I could decouple these packaging fixes/features from the new upstream release which I uploaded to Debian Experimental for now. Testers for the 4.2.0-1 package are very welcome!
Oh, and by the way, that upstream comment (or ArchLinux’s according announcement) about broken backwards compatibility with attaching to running sessions started with older Screen releases doesn’t affected Debian since that has been fixed in Debian already with the package which is in Wheezy. (Thanks again Julien Cristau for the patch back then!)
While there are bigger long-term plans at upstream, Amadeusz is already working on the next 4.x release (probably named 4.2.1) which will likely incorporate some of the patches floating around in the Linux distributions’ packages. At least SuSE and Debian offered their patches explicitly for upstream inclusion.
So far already two patches found in the Debian packages have been obsoleted by upstream git commits after the 4.2.0 release. Yay!
Updates (8th of May 2014): 4.2.0 in Testing, Upstream released 4.2.1
screen 4.2.0-2 migrated to testing now.
Upstream released 4.2.1 in the meanwhile with most Debian patches
applied. Despite being a minor update, it was necessary to bump it’s
internal message version, so vanilla 4.2.1 clients can’t connect to
vanilla 4.2.0 servers. Accordingly it may take a moment until 4.2.1 hits
Debian as I need to sort out some stuff before uploading that version.
Tagged as: anniversary, birthday, Debian, Experimental, git, GNU Screen, Jessie, Screen, Sid, Testing, upload
// show without comments // write a comment
Related stories
Friday·16·November·2012
Useful but Unknown Unix Tools: dwdiff better than wdiff + colordiff //at 01:18 //by abe
A year ago I wrote in Useful but Unknown Unix Tools: How wdiff and colordiff help to choose the right Swiss Army Knife about using wdiff and colordiff together. Colordiff’ed wdiff output looks like this:
$ wdiff foobar.txt barfoo.txt | colordiff [-foo-]bar fnord gnarz hurz quux bla {+foo+} fasel
But if you have colour, why still having these hard to read wdiff markers still in the text?
There exists a tool named dwdiff which can do word diffs in colour without
textual markers and with even less to type (and without being
git diff --color-words
;-). Actually it looks like
git diff --color-words
, just without the git:
$ dwdiff -c foobar.txt barfoo.txt foo bar fnord gnarz hurz quux bla foo fasel
Another cool thing about dwdiff (and its name giving feature) is that you can defined what you consider whitespace, i.e. which character(s) delimit the words. So lets do the example above again, but this time declare that “f” is considered the only whitespace character:
$ dwdiff -W f -c foobar.txt barfoo.txt foo bar bar fnord gnarz hurz quux bla foo fasel
dwdiff can also show line numbers:
$ dwdiff -c -L foobar.txt barfoo.txt 1:1 foo bar fnord 2:2 gnarz hurz quux 3:3 bla foo fasel $ dwdiff -c -L foobar.txt quux.txt 1:1 foo bar fnord 1:2 foobar floedeldoe 2:3 gnarz hurz quux 3:4 bla foo fasel
(coloured shell screenshots by aha)
Tagged as: aha, colordiff, dwdiff, git, UUUT, wdiff
// show without comments // write a comment
Related stories
Monday·20·February·2012
Git Snapshot of GNU Screen in Debian Experimental //at 01:09 //by abe
I just uploaded a snapshot of GNU Screen to Debian Experimental. The package (4.1.0~20110819git450e8f3-1) is based on upstream’s HEAD whose most recent commit currently dates to the 19th of August 2011.
While the upload fixes tons of bugs which accumulated over the past two years in Debian’s, Ubuntu’s and upstream’s bug tracker, I don’t yet regard it as suitable for the next stable release (and hence for Debian Unstable) since there’s one not so nice issue about it:
- #644788: screen 4.1.0 can’t attach to a running/detached screen 4.0.3 session
Nevertheless it fixes a lot of open issues (of which the oldest is a wishlist bug report dating back to 1998 :-) and I didn’t want to withhold it from the rest of the Debian community so I uploaded it to Debian Experimental.
Issues closed in Debian Experimental
- #25096: digraph table should be run-time configurable
- #152961: lacks tsl/fsl/dsl caps
- #176626: mini-curses type of interface for screen -r w/ multiple screens? (Fixed by suggesting iselect, screenie or byobu)
- #223320: does not switch mouse mode
- #344759: mishandles xterm control string to set window title
- #353090: please enable the built-in telnet
- #361274: cannot reattach to sessionname if there is another session with similar sessionname
- #450421: please raise MAXWIN to at least 100 (merged with #499273)
- #461107: Requires test -t 0 even when opening a new window on existing screen
- #481411: window created with ‘-d -m’ silently ignores ‘-X exec’
- #488619: Session name string escape
- #496750: screen -d -m and -D -m segfault if setenv given with no value in a configuration file
- #532240: screen with caption SEGVs when resized to 1 line tall
- #541793: “C-a h” (mis)documented twice
- #558724: breaks altscreen
- #560231: Please remove restriction on user/login name length
- #578729: outputs spaces when refreshing/attaching a window with “defbce on”
- #591624: segfault when running “screen -d -m” with “layout save default” in .screenrc
- #603009: Updating the screen Uploaders list
- #612990: /etc/init.d/screen-cleanup: should check for existence of screen binary
- #621704: Fix slow scrolling in vertical splits
- #630535: manpage typo
- #641867: version bump (this bug report sparked the upload :-)
Update: Issues also closed in Debian Experimental, but not (yet) mentioned in the Debian changelog
- #238535: screen lock can no more be bypassed by reattaching.
- #446082: Shows cursor in front of the selected window in “windowlist -b”.
- #522689: Passes signals to programs running inside screen on kfreebsd.
- #526002: Adds focus left/right commands.
- #611453: Documents vertical split in man-page.
- #621804 and #630976: Allows longer $TERM than 20 characters
Issues which will be closed in Ubuntu
- #183849: update to git version of screen
- #315237: crashes with certain options and terminal sizes
- #582153: doesn’t accept login names longer than 20 chars
- #588846: slow when using vertical split
- #702094: Copying and pasting from mutt includes many trailing spaces
- #786292: segfaults if using layout saving with “-D -m”
- #788670: segfault in screen/byobu in natty
Please test the version from Experimental
If you are affected by one of the issues mentioned above, please try the version from Debian Experimental and check if they’re resolved for you, too.
Thanks to all who contributed!
A lot of the fixes have been made or applied upstream by Sadrul Habib Chowdhury who also industriously tagged Debian bug reports as “fixed-upstream”. Thanks!
Thanks also to Brian P Kroth who gave the initial spark to this upload by packaging Fedora 15’s git snapshot for Debian and filing bug although the upload is based on the current HEAD version of GNU Screen as this fixes some more important issues than the snapshot Fedora 15 includes. That way also two patches from Fedora/RedHat’s screen package are included in this upload.
(Co-) Maintainer wanted!
Oh, and if you care about the state of GNU Screen in Debian, I’d really appreciate if you’d join in and contribute to our collab-maint git repository – there are still a lot of issues unresolved and I know that I won’t be able to fix all of them myself. And since Hessophanes unfortunately currently has not enough time for the package, we definitely need more people maintaining this package.
P.S.
Yes, I know about tmux and tried to get some of my setups
working with it, too. But I still prefer screen over tmux.
:-)
Tagged as: byobu, Debian, Experimental, git, GNU, GNU Screen, iselect, screen, screenie, snapshot, tmux, Ubuntu, upload
// show without comments // write a comment
Related stories
Thursday·27·October·2011
Daily Snapshot .debs of Conkeror //at 22:57 //by abe
Keeping track with packaging software which is under heavy development can be time-consuming. I noticed this while packaging Conkeror, because there was quite a demand for up-to-date packages, especially from upstream themself.
So recently on the IRC channel #conkeror the idea of automatically built Debian packages came up. After a few hours of experimenting and a few days of steadily optimizing, I can proudly present daily built snapshot packages of Conkeror for currently Lenny and Sid, ready to be included in your sources.list:
deb http://noone.org/conkeror-nightly-debs lenny main deb-src http://noone.org/conkeror-nightly-debs lenny main deb http://noone.org/conkeror-nightly-debs sid main deb-src http://noone.org/conkeror-nightly-debs sid main
The binary package conkeror-spawn-process-helper is currently only built for the i386 architecture, but other architectures may follow.
The packages probably work also on any other Debian based distribution (e.g. Ubuntu) which includes XULRunner version 1.9.
Surely they are not of the usual Debian quality, but they should do it for staying up-to-date with the Conkeror development just by using your favourite APT frontend.
The script which generates those packages is also available in the Conkeror git repository at repo.or.cz.
The APTable archive is generated with reprepro. Packages and the repository are signed with the passphrase-less GnuPG key 373B76B4 which is used only for the Conkeror nightly builds. (If anyone knows a better solution for automatic builds than a passphrase-less key, please tell me. :-)
P.S.: I really like the new keybindings “<<”, “>>” and
“G”. :-)
Tagged as: APT, Browser, build, Conkeror, daily, deb, Debian, git, GnuPG, gpg, i386, IRC, keybindings, Lenny, nightly, packaging, pgp, repo.or.cz, repository, reprepro, Sid, signing, snapshot, Ubuntu, XULRunner
// show without comments // write a comment
Related stories
Thursday·22·September·2011
Emacs Macros: Repeat on Steroids //at 16:06 //by abe
vi users have their .
(dot) redo command for repeating
the last command. The article Repeating Commands in Emacs in Mickey Petersen’s blog Mastering Emacs explained
Emacs’ equivalent for that, namely the command repeat
, by
default bound to C-x z
.
I though seldomly use it as I mostly have to repeat a chain of commands. What I use are so called Keyboard Macros.
For example for the CVE-2011-3192 vulnerability in Apache I added a line like
Include /etc/apache2/sites-common/CVE-2011-3192.conf
to
all VirtualHosts.
So I started Emacs with all the relevant files: grep
CVE-2011-3192 -l /etc/apache2/sites-available/*[^~] | xargs emacs
&
To remove those “Include” lines again M-x flush-lines
is
probably the easiest way in Emacs. So for every file I had to call
flush-lines with always the same parameter, save the buffer and then
close the file or — in Emacsish — “kill” the buffer.
So while working on the first file I recorded my doing as a keyboard macro:
C-x (
- Start recording
M-x flush-lines<Enter>CVE-2011-3192<Enter>
- flush all lines which contain the string “CVE-2011-3192”
C-x C-s
- save the current buffer
C-x C-k<Enter>
- kill the current buffer, i.e. close the file
C-x )
- Stop recording
Then I just had to call the saved macro with C-x e
. It
flushed all lines, saved the changes and switched to the next
remaining file by closing the current file with three key-strokes. And
to make it even easier, from the second occasion on I only had to
press e
to call the macro directly again. So I just
pressed e
for a bunch of time and had all files edited.
(In this case I used git diff
afterwards to check that I
didn’t wreck anything by half-automating my editing. :-)
Of course there are other ways to do this, too, e.g. use
sed
or so, but I still think it’s a neat example for
showing the power of keyboard macros in Emacs. More things you can do
with Emacs Keyboard Macros are described in the EmacsWiki entry Keyboard Macros.
And if you still miss vi’s .
command in Emacs, you can
use the dot-mode, an Emacs mode currently maintained by Robert Wyrick
which more or less automatically defines keyboard macros and lets you
call them with C-.
.
Tagged as: Apache, CLI, CVE, CVE-2011-3192, dot-mode, Emacs, EmacsWiki, git, macro, Other Blogs, redo, repeat, vi, xargs
// show without comments // write a comment
Related stories
Thursday·01·September·2011
Useful but Unknown Unix Tools: How wdiff and colordiff help to choose the right Swiss Army Knife //at 12:18 //by abe
In light of the fact that it seems possible to fit the plastic caps of a Debian branded Swiss Army Knife (Last orders today!) on an existing Swiss Army Knife (German written howto as PDF), I started to think about which Victorinox Cybertool would be the best fitting for me.
And because the Victorinox comparison page doesn’t really show diffs, just columns with floating text which are not very helpful for generating diffs in your head, I used command line tools for that purpose:
wdiff
Because the floating texts are not line- but just whitespace-based,
the tool of choice is not diff
but wdiff
, a word-based diff. It encloses additions and removals
in {+…+}
and [-…-]
blocks.
(No, those aren’t Japanese smileys although they look a lot like some.
^^).
The easiest and clearest way is to copy and paste the texts from Victorinox’ comparison page into some text files and
compare them with wdiff
:
$ wdiff cybertool34.txt cybertool41.txt
{+Schraubendreher 2.5mm,+} Pinzette, Nähahle mit Nadelöhr, {+Holzsäge,+} Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange( Hülsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), {+Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), {+Holzmeissel / Schaber,+} Bit-Halter, Stecknadel, inox, Schere, Korkenzieher, Zahnstocher
So this already extracted the information which are the seven tools which are in the Cybertool 41, but not in the Cybertool 34. Nevertheless the diff is still not easily recognizable on the first glance. There are several ways to help here.
First wdiff
has an option --no-common
(the
according short option is -3
) which just shows added and
removed words:
$ wdiff -3 cybertool34.txt cybertool41.txt ====================================================================== {+Schraubendreher 2.5mm,+} ====================================================================== {+Holzsäge,+} ====================================================================== {+Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} ====================================================================== {+Holzmeissel / Schaber,+} ======================================================================
This is already way better to quickly recognize the actual differences.
But if you still also want to see the common tools of the two knifes you need some visual help:
One option is to use wdiff
’s --terminal
(or
short -t
) option. Added words are then displayed inverse
and removed words are shown underlined (background and foreground
colors hardcoded as there is no “invert colors” style in CSS or HTML):
$ wdiff -t cybertool34.txt cybertool41.txt
Schraubendreher 2.5mm, Pinzette, Nähahle mit Nadelöhr, Holzsäge, Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange( Hülsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ), Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, Druckkugelschreiber, Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), Holzmeissel / Schaber, Bit-Halter, Stecknadel, inox, Schere, Korkenzieher, Zahnstocher
But some still like to to use color instead of the contrast-rich inverse and the easily to oversee underlining. This is where colordiff comes into play:
colordiff
colordiff is like syntax highlighting for diffs on the
command line. I works with classic and unified diffs as well as with
wdiffs and debdiffs (the debdiff
command is part of the
devscripts package).
$ wdiff cybertool34.txt cybertool41.txt | colordiff
{+Schraubendreher 2.5mm,+} Pinzette, Nähahle mit Nadelöhr, {+Holzsäge,+} Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange( Hülsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), {+Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), {+Holzmeissel / Schaber,+} Bit-Halter, Stecknadel, inox, Schere, Korkenzieher, Zahnstocher$ wdiff cybertool29.txt cybertool41.txt | colordiff
{+Schraubendreher 2.5mm,+} Pinzette, Nähahle mit Nadelöhr, {+Holzsäge,+} Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), {+Kombizange( Hülsenpresser, Drahtschneider ),+} Stech-Bohrahle, {+Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, [-Druckkugelschreiber,-] Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), {+Holzmeissel / Schaber,+} Bit-Halter, Stecknadel, inox, {+Schere,+} Korkenzieher, Zahnstocher
(Coloured “Screenshots” done with ANSI HTML Adapter from the package aha.)
Some, especially those who are used to git, are probably
confused by the default choice of diff colors. This is easily fixable
by writing the following into you ~/.colordiffrc
:
newtext=green oldtext=red diffstuff=darkblue cvsstuff=darkyellow
(See also /etc/colordiff
for the defaults and hints.)
colordiff
has by the way two operating modes:
- Without parameter it reads diffs from standard input as seen above.
- With parameters it works as drop-in diff replacement including all diff options as shown below.
So now let us compare the Cybertool 29 with Cybertool 34 in a normal diff (by using the texts from above and replacing all commata with newline characters) with git-like colors:
$ colordiff cybertool29-lines.txt cybertool34-lines.txt 12a13,14 > Kombizange( Hülsenpresser > Drahtschneider ) 13a16,17 > Kugelschreiber( auch zum DIP-Switch verstellen ) > Mehrzweckhaken (Paketträger) 16d19 < Druckkugelschreiber 25a29 > Schere
Or as unifed diff with some context:
$ colordiff -u cybertool29-lines.txt cybertool34-lines.txt --- cybertool29-lines.txt 2011-08-31 20:55:37.195546238 +0200 +++ cybertool34-lines.txt 2011-08-31 20:55:11.667710504 +0200 @@ -10,10 +10,13 @@ Bit Torx 8 Bit Torx 10 Bit Torx 15 ) +Kombizange( Hülsenpresser +Drahtschneider ) Stech-Bohrahle +Kugelschreiber( auch zum DIP-Switch verstellen ) +Mehrzweckhaken (Paketträger) Dosenöffner( kleiner Schraubendreher ) Kleine Klinge -Druckkugelschreiber Grosse Klinge Ring inox @@ -23,5 +26,6 @@ Bit-Halter Stecknadel inox +Schere Korkenzieher Zahnstocher
So if you want nicely colored diffs with Subversion like you’re used
to with git, you can use svn diff | colordiff
.
Tagged as: aha, colordiff, Colorful Console, Cybertool, debdiff, Debian, devscripts, diff, git, nuggets, SAK, svn, Swiss Army Knife, UUUT, Victorinox, wdiff
// show without comments // write a comment