9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] Fix error messages from sshfs
@ 2022-01-07 11:34 Benjamin Riefenstahl
  0 siblings, 0 replies; only message in thread
From: Benjamin Riefenstahl @ 2022-01-07 11:34 UTC (permalink / raw)
  To: 9front

[-- 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;
 			}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-07 12:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 11:34 [9front] Fix error messages from sshfs Benjamin Riefenstahl

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