From owner-freebsd-bugs@FreeBSD.ORG Wed Jan 26 14:30:23 2005 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA43416A4D0 for ; Wed, 26 Jan 2005 14:30:23 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C413F43D58 for ; Wed, 26 Jan 2005 14:30:16 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id j0QEUGYl076156 for ; Wed, 26 Jan 2005 14:30:16 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id j0QEUGs4076144; Wed, 26 Jan 2005 14:30:16 GMT (envelope-from gnats) Resent-Date: Wed, 26 Jan 2005 14:30:16 GMT Resent-Message-Id: <200501261430.j0QEUGs4076144@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Vasil Dimov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F164A16A4CE for ; Wed, 26 Jan 2005 14:27:48 +0000 (GMT) Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5236843D3F for ; Wed, 26 Jan 2005 14:27:48 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from sinanica.bg.datamax (sinanica.bg.datamax [192.168.10.1]) by jengal.datamax.bg (Postfix) with QMQP id D63F687CA for ; Wed, 26 Jan 2005 16:27:46 +0200 (EET) Received: (nullmailer pid 59749 invoked by uid 1004); Wed, 26 Jan 2005 14:27:46 -0000 Message-Id: <1106749666.788116.59748.nullmailer@sinanica.bg.datamax> Date: Wed, 26 Jan 2005 16:27:46 +0200 From: Vasil Dimov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/76711: parse error in rm.c:check() while parsing value returned from strmode(3) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Vasil Dimov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2005 14:30:24 -0000 >Number: 76711 >Category: bin >Synopsis: parse error in rm.c:check() while parsing value returned from strmode(3) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jan 26 14:30:16 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Vasil Dimov >Release: FreeBSD 5.3-STABLE i386 >Organization: DataMax >Environment: System: FreeBSD sinanica.bg.datamax 5.3-STABLE FreeBSD 5.3-STABLE #11: Wed Jan 5 09:46:27 EET 2005 root@sinanica.bg.datamax:/usr/src/sys/i386/compile/SINANICA-SMP i386 >Description: rm's check() function uses strmode(3) to convert file's access bits into a human-readable text (rw-r--r--). As the 11th symbol returned from strmode(3) is either '+' or ' ' rm tries to put additional space in case of '+', or nothing in case of ' '. Instead of 11th the 10th symbol is checked which is never space - others-execute-bit's representation is one of x-sStT. As a result additional space arrives after file's mode string. >How-To-Repeat: $ su - root -c "touch /tmp/a" $ rm /tmp/a override rw-r--r-- root/wheel for /tmp/a? (notice the two spaces before root/wheel, irritating?) >Fix: --- rm.c.modep.patch begins here --- --- rm.c.orig Fri Jan 21 11:46:28 2005 +++ rm.c Wed Jan 26 15:37:39 2005 @@ -459,10 +459,10 @@ if ((flagsp = fflagstostr(sp->st_flags)) == NULL) err(1, "fflagstostr"); (void)fprintf(stderr, "override %s%s%s/%s %s%sfor %s? ", - modep + 1, modep[9] == ' ' ? "" : " ", + modep + 1, modep[10] == ' ' ? "" : " ", user_from_uid(sp->st_uid, 0), group_from_gid(sp->st_gid, 0), - *flagsp ? flagsp : "", *flagsp ? " " : "", + *flagsp ? flagsp : "", *flagsp ? " " : "", path); free(flagsp); } --- rm.c.modep.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: