From owner-freebsd-bugs@freebsd.org Mon Jan 4 12:28:25 2016 Return-Path: Delivered-To: freebsd-bugs@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 3187CA61CC4 for ; Mon, 4 Jan 2016 12:28:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 092A515DE for ; Mon, 4 Jan 2016 12:28:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u04CSOJB086882 for ; Mon, 4 Jan 2016 12:28:24 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 205871] install(1) in endless loop for orphaned symlinks Date: Mon, 04 Jan 2016 12:28:25 +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: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: frank@pinky.sax.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-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 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 MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2016 12:28:25 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D205871 Bug ID: 205871 Summary: install(1) in endless loop for orphaned symlinks Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: frank@pinky.sax.de install(1) with option "-d" creates directories. If the final target or an intermediate directory is a symbolic link, that points to a none existing file/directory, then install will enter an endless loop. I believe the behaviour was introduced with base r272026 | mjg | 2014-09-23 13:41:09 +0200 (Tue, 23 Sep 2014). It was observed when using mergemaster for a jail setup with ezjail. In that case symlinks visited from host can point to not existing directories on ho= st system. environment:=20 FreeBSD 11.0-CURRENT #10 r292982M: how to repeat: % ln -s /notexists /tmp/ % install -d /tmp/notexists & [1] 9843 % ps -v -p 9843 PID STAT TIME SL RE PAGEIN VSZ RSS LIM TSIZ %CPU %MEM COMMAND 9843 R 1:12.80 127 73 0 8356 2024 - 28 100.0 0.0 install -d /tmp/notexists % kill -ABRT 9843 % gdb /usr/bin/install install.core (gdb) bt #0 stat () at stat.S:3 #1 0x0000000000402e0b in main (argc=3D, argv=3D) at /usr/src11/usr.bin/xinstall/xinstall.c:1269 (gdb) list 1269 1264 for (p =3D path;; ++p) 1265 if (!*p || (p !=3D path && *p =3D=3D '/')) { 1266 ch =3D *p; 1267 *p =3D '\0'; 1268 again: 1269 if (stat(path, &sb) < 0) { 1270 if (errno !=3D ENOENT) 1271 err(EX_OSERR, "stat %s", pa= th); 1272 if (mkdir(path, 0755) < 0) { 1273 if (errno =3D=3D EEXIST) (gdb) q The stat call returns ENOENT and mkdir returns with EEXIST - that creates an endless loop. --=20 You are receiving this mail because: You are the assignee for the bug.=