From nobody Wed Nov 15 06:19:57 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SVY196Hxxz510QT for ; Wed, 15 Nov 2023 06:19:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SVY193Zfqz3G8V for ; Wed, 15 Nov 2023 06:19:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700029197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nI+6O+shFX53MeeX/iBPa8o4Qrzp1GvDHb+dBOz52Vw=; b=SQYkRFjIymfKlmis6VV/f+RYRf2ZX31JXO0bk/llVsuAw+MDr5qFo3te6C7N0IxUxWT/Iv W9ZQpkbOf1Ynu72kIdSJr95IthESW13nqf0i19GY4jmglLZfaY7+2zHtjR5UFHkR7jAzcs P1udrfTY9l8yInLxjHsLh6yEssU83pb3f5RGn2Z9CRAoNL947IkLKMyW/oJe+sqnTOt/gd Zd51MT83WngdhXUB/66BQqlppM55cEKXtIn+ZW+7DcP7nY8p2Hfjeh7RxTKFc3jG1fQs8y 2MtGt/5+3rN4mS1SxD8N5nf0SqMHSWMWdbgSON28ZR1NHOyB3UP8/nNO+VNEnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700029197; a=rsa-sha256; cv=none; b=GiqQmd0mNKjv6oun6gBG+w6N/ZUZ+l2qEHcjnln+PX/VF8YcDQPhntt3KP2KIng2yrjIlr ODbHaOtfhSWJvlRiRAP+B2RY7hBpX08JnVjTBdiz42xnVk8v0dxap/ytnGzZ5jcLV0c4M3 L9oTTbcT8riXE7abrQPm35MIta1bClqS7zvRqztDygkjmPz9ahaA5q1kuoTkKweBhBN+B0 xpTIsfdnQMgej2cnvglsHqAPAeAbjeTWVmmfqzYmKmo/LhHyodSGs3UaODQXW+/Txpf/ZM Iol7qkj7swKwViUKJlzuYw54g1JlHcj/QZ6tnbjJHvRh2lliTU7UGB3j6Ob9yA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SVY192XVSz1KwW for ; Wed, 15 Nov 2023 06:19:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 3AF6Jvcq034095 for ; Wed, 15 Nov 2023 06:19:57 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 3AF6JvUG034094 for bugs@FreeBSD.org; Wed, 15 Nov 2023 06:19:57 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 275099] cat(1) can't read directories Date: Wed, 15 Nov 2023 06:19:57 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: msl0000023508@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275099 Bug ID: 275099 Summary: cat(1) can't read directories Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: msl0000023508@gmail.com Attachment #246324 text/plain mime type: Created attachment 246324 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D246324&action= =3Dedit helloworld-dir.c While it is not common to read(2) a directory directly, this is still suppo= rted in FreeBSD (with security.bsd.allow_read_dir=3D1); and it could be actually useful in FUSE as an user space file system implementation may provide some data in a directory itself. The followings demonstrate the issue with a FUSE-based file system: # sysctl security.bsd.allow_read_dir=3D1 security.bsd.allow_read_dir: 0 -> 1 # helloworld-dir /mnt/3/ # ls -al /mnt/3/ total 0 drwxr-xr-x 2 root wheel 27 Jan 1 1970 . drwxr-xr-x 2 root wheel 13 Jan 1 1970 hello # ls -al /mnt/3/hello/ total 0 drwxr-xr-x 2 root wheel 13 Jan 1 1970 . drwxr-xr-x 2 root wheel 27 Jan 1 1970 .. -rw-r--r-- 1 root wheel 12 Jan 1 1970 world # cat /mnt/3/hello/world=20 Hello world # cat /mnt/3/hello cat: stdout: Is a directory # dd status=3Dnone if=3D/mnt/3/hello Hello world! # cat /mnt/3/ cat: stdout: Is a directory # dd status=3Dnone if=3D/mnt/3/ This is the root directory # umount /mnt/3/ It shows that cat(1) failed to read the directories but dd(1) works without problem. The cause is that cat(1) tries to use copy_file_range(2) to copy input file= to stdout but this system call dosen't work on directories as documented, and cat(1) didn't fallback to read(2) and write(2) on copy_file_range(2) fail w= ith EISDIR. The FUSE program for demonstration is attached. --=20 You are receiving this mail because: You are the assignee for the bug.=