9front - general discussion about 9front
 help / color / mirror / Atom feed
From: qwx@sciops.net
To: 9front@9front.org
Subject: Re: [9front] this history(1) is scratched
Date: Mon, 14 Nov 2022 00:20:22 +0100	[thread overview]
Message-ID: <4F3FECF74D0D8AB5A41EA721BCAC9295@wopr.sciops.net> (raw)
In-Reply-To: <Y3BlG+FFjpQOMBFk@alice>

Hello,

Sorry for the delay.  After a bunch of testing, I agree with Eckard
wrt.  how the substitution should be done, I had used `sub($1
"["FS"]+", "")' with success, but `gsub($1 "[ \t]+", "")' might make
more sense.

	; history /lib/vgadb
	Aug 21 10:50:43 CES 2022 /lib/vgadb 44403 [qwx]
	Aug 21 10:50:43 CES 2022 /n/dump/2022/1113/lib/vgadb 44403 [qwx]
	Aug 20 20:42:16 CES 2022 /n/dump/2022/0821/lib/vgadb 44403 [qwx]
	Aug 12 06:47:55 CES 2022 /n/dump/2022/0820/lib/vgadb 44398 [qwx]
	[...]


Unfortunately, there's another issue, handling files with spaces:

	; history '/lib/v/The Power Glove (NES) - Angry Video Game Nerd (AVGN)-MYDuy7wM8Gk.mkv'
	Aug 30 14:05:32 CES 2021 /lib/v/The 0 [Glove]
	walk: path: '/n/dump/2022/1113/lib/v/The Power Glove (NES) - Angry Video Game Nerd (AVGN)-MYDuy7wM8Gk.mkv': '''' directory entry not found
	Nov 13 23:20:18 CET 2022walk: path: '/n/dump/2022/1113/lib/v/The Power Glove (NES) - Angry Video Game Nerd (AVGN)-MYDuy7wM8Gk.mkv': '''' directory entry not found


That seems easy to fix: awk is fed the output of ls -qr, and it's
enough to add -Q there.  Later, pretty printing the paths must also be
adjusted.  That seems to be enough:

	; history '/lib/v/The Power Glove (NES) - Angry Video Game Nerd (AVGN)-MYDuy7wM8Gk.mkv'
	Aug 30 14:05:32 CES 2021 /lib/v/The Power Glove (NES) - Angry Video Game Nerd (AVGN)-MYDuy7wM8Gk.mkv 33349226 [qwx]
	Aug 30 14:05:32 CES 2021 /n/dump/2022/1113/lib/v/The Power Glove (NES) - Angry Video Game Nerd (AVGN)-MYDuy7wM8Gk.mkv 33349226 [qwx]


I don't know if the quotes should be preserved in that case.  I also
agree with Anthony that care should be taken when something like this
occurs; then again it's rare enough that maybe forcing an announcement
on the ml is enough?  This has usually been the way thus far for any
breaking or important changes.

Patch below, any comments welcome.  Thanks!

Cheers,
qwx


diff 7fcf96b44dc4765605b827ba49d389b5711d7e72 uncommitted
--- a//rc/bin/history
+++ b//rc/bin/history
@@ -6,7 +6,7 @@
 
 fn prfile {
 	echo -n `{date $flagu -f 'MMM DD hh:mm:ss ZZZ YYYY' `{walk -e m $1}}
-	walk -e psM $1 | awk '{printf " %s %lld [%s]\n", $1,$2,$3,$4}'
+	walk -e psM $1 | awk '{$NF="["$NF"]"; print " "$0}'
 }
 
 fn diffflags {
@@ -31,12 +31,12 @@
 		echo history: warning: $file does not exist >[1=2]
 
 	old=()
-	ls -qr /n/$dump/*/*/$file >[2] /dev/null |
+	ls -Qqr /n/$dump/*/*/$file >[2] /dev/null |
 	sed  's/\(([^ ]*) *([^ ]*) *([^ ]*)\)/\1\2\3/p' |
 	awk '"/n/'$dump/$since'" <= $2 {next}
 	     $1 != qid {
 		qid=$1
-		gsub($1, "")
+		gsub($1"[ \t]+", "")
 		print}' |
 	while(new=`$nl{read}){
 		prfile $new

  reply	other threads:[~2022-11-13 23:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12  8:15 qwx
2022-11-12 11:03 ` Eckard Brauer
2022-11-12 12:16   ` Eckard Brauer
2022-11-12 18:07     ` Eckard Brauer
2022-11-12 19:13 ` ori
2022-11-12 20:32   ` Eckard Brauer
2022-11-12 20:44     ` Eckard Brauer
2022-11-12 20:53       ` Eckard Brauer
2022-11-12 21:26     ` ori
2022-11-12 22:43       ` umbraticus
2022-11-13  3:35   ` Anthony Martin
2022-11-13 23:20     ` qwx [this message]
2022-11-15 11:49       ` qwx
2022-11-15 21:59         ` qwx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3FECF74D0D8AB5A41EA721BCAC9295@wopr.sciops.net \
    --to=qwx@sciops.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).