From owner-freebsd-emulation@freebsd.org Tue Dec 6 21:30:19 2016 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3021CC6BB86 for ; Tue, 6 Dec 2016 21:30:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 4738DFB6; Tue, 6 Dec 2016 21:30:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA24018; Tue, 06 Dec 2016 23:30:15 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cENJX-000H4f-0R; Tue, 06 Dec 2016 23:30:15 +0200 Subject: Re: /compat/linux/dev and an odd program To: Tijl Coosemans References: <1668707b-3f94-ccc4-068c-04869620b4f4@FreeBSD.org> <20161206195520.367929e9@kalimero.tijl.coosemans.org> Cc: freebsd-emulation@FreeBSD.org From: Andriy Gapon Message-ID: <5286e838-f730-c5ff-9d25-119d1ededd23@FreeBSD.org> Date: Tue, 6 Dec 2016 23:29:16 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161206195520.367929e9@kalimero.tijl.coosemans.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2016 21:30:19 -0000 On 06/12/2016 20:55, Tijl Coosemans wrote: > On Tue, 6 Dec 2016 18:49:06 +0200 Andriy Gapon wrote: >> I have an old binary-only Linux program that, for whatever reason, opens >> /dev/null with O_CREAT flag (O_WRONLY | O_CREAT | O_TRUNC). That works fine >> when there is no /compat/linux/dev: the code in kern_alternate_path() sees that >> the directory does not exist, strips /compat/linux prefix and, so, the real >> /dev/null is found. But typically, if linux_base is installed, there is >> /compat/linux/dev directory, because of /compat/linux/dev/shm/. The code will >> see the directory and, thus, it will try to open /compat/linux/dev/null. But >> there is no such file, so it will try to create it. And fail with EPERM for a >> non-privileged user. >> >> I wonder if anyone has thoughts or suggestions on this situation. >> Either an administrative solution or a code change would be fine for me. >> Thanks! > > Try creating this symlink: > > ln -s /dev/null /compat/linux/dev/null > That does the job, thank you! -- Andriy Gapon