9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
To: 9front@9front.org
Subject: [9front] Fix error messages from sshfs
Date: Fri, 07 Jan 2022 12:34:29 +0100	[thread overview]
Message-ID: <87bl0n230a.fsf@turtle-trading.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Hi all,

As discussed in the previous thread "ape/_errno: ENOENT", APE has
difficulties classifying the error messages from sshfs, because sshfs
passes through the error messages from the server.  This patch fixes
that for the currently known errors by using sshfs's own error strings
as far as possible.

Thanks, benny

[-- Attachment #2.1: Type: text/plain, Size: 270 bytes --]

from postmaster@4ess:
The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Type: text/x-diff
	Content-Disposition: inline; filename=sshfs.patch

[-- Attachment #2.2: sshfs.patch.suspect --]
[-- Type: application/octet-stream, Size: 1128 bytes --]

From: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
Date: Fri, 07 Jan 2022 10:37:02 +0000
Subject: [PATCH] cmd/sshfs.c (recvproc): prefer error codes over error strings

Strings for existing codes in the most used server (OpenSSH) just
repeat the error code name.  OTOH we like to have wording of the
strings under our control as much as possible, so we can easier find
and process them.  Error strings are still usefull as fallback for
compatibility with future versions of the server.
diff f81f2ada0a4fdb358371e8cf30c3cebc2ebaa27e 50d3bcf17bc3a73903c50beb33e8fa38ba97c2c6
--- a/sys/src/cmd/sshfs.c	Tue Jan  4 17:37:43 2022
+++ b/sys/src/cmd/sshfs.c	Fri Jan  7 11:37:02 2022
@@ -1144,12 +1144,14 @@
 				r->req->ofcall.count = 0;
 				e = nil;
-			}else if(msgn > 0){
-				e = msg;
-				e[msgn] = 0;
+			/* prefer our well-defined error strings to arbitrary
+			 * strings from the server */
 			}else if(code < nelem(errors))
 				e = errors[code];
-			else{
+			else if(msgn > 0){
+				e = msg;
+				e[msgn] = 0;
+			}else{
 				snprint(ebuf, sizeof(ebuf), "error code %d", code);
 				e = ebuf;

             reply	other threads:[~2022-01-07 12:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 11:34 Benjamin Riefenstahl [this message]
2022-01-21 14:23 ` [9front] " Benjamin Riefenstahl
2022-01-22 18:18 ` [9front] " ori
2022-01-23 13:31   ` Benjamin Riefenstahl

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:

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

  git send-email \
    --in-reply-to=87bl0n230a.fsf@turtle-trading.net \
    --to=b.riefenstahl@turtle-trading.net \
    --cc=9front@9front.org \


* 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).