From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from tb-mx0.topicbox.com (localhost.local [127.0.0.1]) by tb-mx0.topicbox.com (Postfix) with ESMTP id 62BB22AA906A for <9fans@9fans.net>; Sat, 6 Jun 2020 08:12:08 -0400 (EDT) (envelope-from alexander.kapshuk@gmail.com) Received: from tb-mx0.topicbox.com (localhost [127.0.0.1]) by tb-mx0.topicbox.com (Authentication Milter) with ESMTP id D5BEFD59977; Sat, 6 Jun 2020 08:12:08 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1591445528; b=ZmVgdqBhX9RQaew3khmvsCM1wGN8BBGgtHeB+SHEk2mYHiPW3i i1WQUtl2v2tkT8RIcawJtKsZtETwFUz0Yt7JLdIF4Rna5tNZPeY7a4fXbh6jYhfu HGzmB97X9os8HywpFxmPcOcGrlte6AYsbE0ZVOomSr3Kcs3DEo6F8fCUAb9Qv6RZ YhjB401DjIVe8AwRYqsevisGKmGySDG6VjSnoPVAln18RdAloTyuPZ7u+fFwzfOS 5cCwxKjlhAJmu5O72AMlgyQbruPKvE98VxToXteV9HlJGaLclUDTs8sI+yDvoyB8 V0aj1QrMotXAzrMZYy14QNp8R4y20FacPvGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; s=arcseal; t=1591445528; bh=Wmz0ML3Ov8kZeOkOLMjujOySXt5fnDAb4wzG3yxJbZA=; b=unWpdFtLkYDo y5FIKkgrD5l7FBK3ZiHSbiq3uDN0n6hDJktVrqsEh7fP9Z496coMZGev+SfSfJzR +rVNV324Ul6EEQbZLHJNGnBrXJYosJFa6pno+KkihhRbrFnn8Ilk5Hdrmuz+grpp ND1B4vfAXEKF4cyjwJBSHKlK4pmFX6Vqzuy8qr29CRvbVBt+1VdstcTf66gurlii yakUkRerBdyUP74Lp75b4yzXWnELB6vVzOYDZDEIXKjkLrw/wWdeWMowHhixt11K XtVoRyxi7uPGJWSo9I72STzrZ2cwF3K/orbpzToWSLXwAj7mV/hojSg/iVy5s+YO fQ8h0rCvHw== ARC-Authentication-Results: i=1; tb-mx0.topicbox.com; arc=none (no signatures found); bimi=none (Domain is not BIMI enabled); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=HuYBN80p header.a=rsa-sha256 header.s=20161025 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.166.67 (mail-io1-f67.google.com); spf=pass smtp.mailfrom=alexander.kapshuk@gmail.com smtp.helo=mail-io1-f67.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=CFmXPuI6; x-ptr=pass smtp.helo=mail-io1-f67.google.com policy.ptr=mail-io1-f67.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 Authentication-Results: tb-mx0.topicbox.com; arc=none (no signatures found); bimi=none (Domain is not BIMI enabled); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=HuYBN80p header.a=rsa-sha256 header.s=20161025 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.166.67 (mail-io1-f67.google.com); spf=pass smtp.mailfrom=alexander.kapshuk@gmail.com smtp.helo=mail-io1-f67.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=CFmXPuI6; x-ptr=pass smtp.helo=mail-io1-f67.google.com policy.ptr=mail-io1-f67.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeghedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeggfhgjhf ffkffuvfgtsehttdertddttdejnecuhfhrohhmpeetlhgvgigrnhguvghrucfmrghpshhh uhhkuceorghlvgigrghnuggvrhdrkhgrphhshhhukhesghhmrghilhdrtghomheqnecugg ftrfgrthhtvghrnhepueejveduffeuvdfglefhffeiuedttdeuudehhfegteelkefhleeg uedugeffjeegnecukfhppedvtdelrdekhedrudeiiedrieejnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehinhgvthepvddtledrkeehrdduieeirdeijedphhgvlhho pehmrghilhdqihhouddqfheijedrghhoohhglhgvrdgtohhmpdhmrghilhhfrhhomhepoe grlhgvgigrnhguvghrrdhkrghpshhhuhhksehgmhgrihhlrdgtohhmqecuuffkkgfgpeeg udelje X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (gmail.com ... _spf.google.com: Sender is authorized to use 'alexander.kapshuk@gmail.com' in 'mfrom' identity (mechanism 'include:_netblocks.google.com' matched)) receiver=tb-mx0.topicbox.com; identity=mailfrom; envelope-from="alexander.kapshuk@gmail.com"; helo=mail-io1-f67.google.com; client-ip=209.85.166.67 Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx0.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Sat, 6 Jun 2020 08:12:07 -0400 (EDT) (envelope-from alexander.kapshuk@gmail.com) Received: by mail-io1-f67.google.com with SMTP id p20so13299542iop.11 for <9fans@9fans.net>; Sat, 06 Jun 2020 05:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Wmz0ML3Ov8kZeOkOLMjujOySXt5fnDAb4wzG3yxJbZA=; b=HuYBN80pee6swawt82M122n/1dsaLcMChUf5y2uUNf0pgT0uZAGk5Mg6AKJe7xkiWA xVgqO5yuTfnZEZwqKGNijyGA/HviuXOSNDhmiaocpKrDextqTzG48zLU17OthO/PDs9+ n1gIKCmV7IHqSqLN5mmEdu3uG7r9xxiLy/G15iW8vngnjGRqLFhG/uMSWtZohhSG/+g3 b+h4ZxqvwwAvws6444E/ZLfsU1CyJpawILJnGmIP2X8wyXhlZ+TgeRB8lC4esi/uN0+P l6G12I3wvZzEyMKzyJIu8Xur9kNN0ZABeOI3yykS/jli3bG2rx5TDNKqLnf3sKqZ4tOB yIgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Wmz0ML3Ov8kZeOkOLMjujOySXt5fnDAb4wzG3yxJbZA=; b=CFmXPuI6/SZfA+nPzlTqoVLEPR23i9xowB2cEtoH37Ykd5bjKLbHEaD/BrUcMEOLRb QvBArgveVmnzeIdy8qpktin954010RygmuVxn87H0oi0gOSN7+QpjZeUf7B3gScGnVKH KC45u1enKbwl8TMrLk2DAtBcUV/8J5P35YTxUBD2W+oPcA29iMBcBO4OPRizUbsp5mzJ fRvBXsMpAf7IDr6LhxcH3Ff6btZOlXHUnD7mH8xQFw7bM7LUJbB1LVKxf1RzOOSdYWkt IEYP4ZTierbAN1qpgSetBIdssUyxyIdRqXB4BSYt4DVm8ofDm0oDpPqJufo6fuNRVCB3 nRyQ== X-Gm-Message-State: AOAM532396OZea8uQ66muYiBfchmCDc7/4KEuayP3ut7fKka1GGD0Ebm FpIh8bm+1ttDlj5c8OTJddjh81DxjfoZsc4XAf0z+5PER6U= X-Google-Smtp-Source: ABdhPJztbr4r6eb2TX3DqbNRJ9HHrWAjDeoniZwU09NUmKEfCPlgzUMHY8/PYJkalB/twYvRFkJyR8X6m9ENwf4TI+U= X-Received: by 2002:a05:6602:13c6:: with SMTP id o6mr12457714iov.84.1591445526817; Sat, 06 Jun 2020 05:12:06 -0700 (PDT) MIME-Version: 1.0 References: <235881e7dc602196b9845c4d10c211a8@hamnavoe.com> <33fdd954-db9a-4273-a0ac-907f07b42499@www.fastmail.com> In-Reply-To: <33fdd954-db9a-4273-a0ac-907f07b42499@www.fastmail.com> From: Alexander Kapshuk Date: Sat, 6 Jun 2020 15:11:30 +0300 Message-ID: Subject: Re: [9fans] `test -x` returns wrong results for directories To: 9fans <9fans@9fans.net> Content-Type: text/plain; charset="UTF-8" Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: f4266c1e-a7ee-11ea-b494-e63c47dc0985 On Sat, Jun 6, 2020 at 9:38 AM Ethan Gardener wrote: > > On Fri, Jun 5, 2020, at 8:22 PM, Richard Miller wrote: > > Looks to me like access(2) is not doing the right thing for directory > > execute (=search) permission. > > thanks for the tip. access is a very simple function. it doesn't do the right thing, but there's a reason: > > BUGS > Since file permissions are checked by the server and group > information is not known to the client, access must open the > file to check permissions. (It calls stat(2) to check sim- > ple existence.) > > it's open() which is failing. i suppose it should. > > if the open fails, maybe access should stat the file, and if it's a directory, try dirread(2). or maybe just opening it for reading will work. i don't know, i'm new to this bit of plan 9 & i haven't slept. > In sysopen, there is a call to namec: /sys/src/9/port/sysfile.c:272 c = namec((char*)arg[0], Aopen, arg[1], 0); Namec would return an error when called to open a directory with execute permissions: /sys/src/9/port/chan.c:1453,1454 if(amode == Aopen && (omode&3) == OEXEC && (c->qid.type&QTDIR)) error("cannot exec directory"); But I'm not sure if this is where the problem actually is, as I haven't seen the 'cannot exec directory' message when running 'test -x dir' in acid: cpu% test -x ch7 cpu% echo $status test 528: false cpu% acid -l truss /bin/test /bin/test:386 plan 9 executable /sys/lib/acid/port /sys/lib/acid/386 /sys/lib/acid/truss acid: progargs = "-x ch7" acid: new() acid: truss() open("ch7", 3) return value: -1 open("#c/pid", 0) return value: 3 pread(3, 0xdfffef08, 20, 4294967295) return value: 12 data: " 533 " close(3) return value: 0 533: breakpoint _exits+0x5 INTB $0x40