From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 24082 invoked from network); 25 Nov 2021 02:23:20 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 25 Nov 2021 02:23:20 -0000 Received: from mail.9lab.org ([168.119.8.41]) by 4ess; Wed Nov 24 21:17:45 -0500 2021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9lab.org; s=20210803; t=1637806653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=0UUSBAWvtLjuqDfy1EB2U6Bac3W6EPXhO6ITQbQ/r+Y=; b=C4qos7L3H7/A3R84Ooz8E+eflM6Y2yLIuG07pc22pg3jiHTgPrVQ0qG2G1ZO/23AYskYfZ HGESrGm3UwagAYiyLl8dLzqlHfdIs7o/KEsJM+BQfaO4vCdc4I7aR8+nOLqc0t8H5k9UgV RMuLdwWEWq3+734B3IgCFvKN6JioSw8= Received: from ken.9lab.home (host-185-64-155-70.ecsnet.at [185.64.155.70]) by mail.9lab.org (OpenSMTPD) with ESMTPSA id 8a6a3362 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Thu, 25 Nov 2021 03:17:33 +0100 (CET) Message-ID: <0F86B9BF6BB00E5721AFCE94A8A6FECF@9lab.org> To: 9front@9front.org CC: igor@9lab.org Date: Thu, 25 Nov 2021 03:17:31 +0100 From: igor@9lab.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-xtesvfiyysvywxmpnvbhmdqbro" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: interface persistence content-driven hardware factory Subject: [9front] [PATCH] rio: allow spaces in working directory path (-cd) when creating a new window Reply-To: 9front@9front.org Precedence: bulk This is a multi-part message in MIME format. --upas-xtesvfiyysvywxmpnvbhmdqbro Content-Disposition: inline Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit The below patch is for review and testing. It enables rio to open new windows in a working directory `dirname` (i.e. using `-cd dirname`) where the dirname path contains spaces. I ran into this issue while browsing hierarchies imported via sshfs(4) in vdir⁽¹⁾, using vdir's feature to open a window with the working directory set to the selected path via right clicking on a path. Please give this a try and/or provide feedback if you run into any issues or disagree with the solution. If there is agreement and no one runs into problems over the next week or two I will merge this patch. ¹…http://shithub.us/phil9/vdir/HEAD/info.html From: Igor Böhm Date: Thu, 25 Nov 2021 01:57:04 +0000 Subject: [PATCH] rio: allow spaces in working directory path (-cd) when creating a new window The initial working directory of the new window may be set by a `-cd directory` option. However, the `-cd directory` option is not capable of handling paths with spaces. To enable paths with spaces the function /sys/src/cmd/rio/wctl.c:/^parsewctl is extended to handle quoted directory paths, using a closing quote as the end of a path instead of a space. Before applying the patch the following will fail to open a new window by writing to /dev/wctl: % rio -i window % mkdir '/tmp/path with space' % echo new -cd '''/tmp/path with space''' window -x rc >> /dev/wctl % pwd /tmp/path with space After applying the patch the above sequence works as expected, opening a window running rc and the working directory set to '/tmp/path with space'. --- diff f8dc73782d90c741e7886629252215c13e35af40 343aafa3a09dd808a1652670d8a7e20021cb0057 --- a/sys/src/cmd/rio/wctl.c Mon Nov 8 00:31:11 2021 +++ b/sys/src/cmd/rio/wctl.c Thu Nov 25 02:57:04 2021 @@ -252,8 +252,13 @@ s++; if(param == Cd){ *cdp = s; - while(*s && !isspace(*s)) - s++; + if(*s == '\''){ /* quoted directory */ + *cdp = ++s; + while(*s && *s != '\'') + s++; + }else + while(*s && !isspace(*s)) + s++; if(*s != '\0') *s++ = '\0'; continue; --upas-xtesvfiyysvywxmpnvbhmdqbro Content-Disposition: attachment; filename=rio-working-directory-with-spaces.patch Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit From: Igor Böhm Date: Thu, 25 Nov 2021 01:57:04 +0000 Subject: [PATCH] rio: allow spaces in working directory path (-cd) when creating a new window The initial working directory of the new window may be set by a `-cd directory` option. However, the `-cd directory` option is not capable of handling paths with spaces. To enable paths with spaces the function /sys/src/cmd/rio/wctl.c:/^parsewctl is extended to handle quoted directory paths, using a closing quote as the end of a path instead of a space. Before applying the patch the following will fail to open a new window by writing to /dev/wctl: % rio -i window % mkdir '/tmp/path with space' % echo new -cd '''/tmp/path with space''' window -x rc >> /dev/wctl % pwd /tmp/path with space After applying the patch the above sequence works as expected, opening a window running rc and the working directory set to '/tmp/path with space'. --- diff f8dc73782d90c741e7886629252215c13e35af40 343aafa3a09dd808a1652670d8a7e20021cb0057 --- a/sys/src/cmd/rio/wctl.c Mon Nov 8 00:31:11 2021 +++ b/sys/src/cmd/rio/wctl.c Thu Nov 25 02:57:04 2021 @@ -252,8 +252,13 @@ s++; if(param == Cd){ *cdp = s; - while(*s && !isspace(*s)) - s++; + if(*s == '\''){ /* quoted directory */ + *cdp = ++s; + while(*s && *s != '\'') + s++; + }else + while(*s && !isspace(*s)) + s++; if(*s != '\0') *s++ = '\0'; continue; --upas-xtesvfiyysvywxmpnvbhmdqbro--