From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 12 22:50:15 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA65A1065678 for ; Mon, 12 Mar 2012 22:50:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 87BE28FC0A for ; Mon, 12 Mar 2012 22:50:15 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q2CMoFYJ028658 for ; Mon, 12 Mar 2012 22:50:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q2CMoFHA028657; Mon, 12 Mar 2012 22:50:15 GMT (envelope-from gnats) Resent-Date: Mon, 12 Mar 2012 22:50:15 GMT Resent-Message-Id: <201203122250.q2CMoFHA028657@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, Nicolas Rachinsky Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 938A5106566B for ; Mon, 12 Mar 2012 22:43:57 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 7E3448FC1C for ; Mon, 12 Mar 2012 22:43:57 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q2CMhuFr054292 for ; Mon, 12 Mar 2012 22:43:56 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q2CMhuDn054261; Mon, 12 Mar 2012 22:43:56 GMT (envelope-from nobody) Message-Id: <201203122243.q2CMhuDn054261@red.freebsd.org> Date: Mon, 12 Mar 2012 22:43:56 GMT From: Nicolas Rachinsky To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/165988: pathchk -p does not work correctly with some locales [PATCH} X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 22:50:15 -0000 >Number: 165988 >Category: bin >Synopsis: pathchk -p does not work correctly with some locales [PATCH} >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 12 22:50:15 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Nicolas Rachinsky >Release: 8.2-RELEASE-p5 >Organization: >Environment: same problem with env -i >Description: pathchk -p ignores codepoints >127 (and all unportable characters behind them). This error seems to be in the latest version in the repository as well. portable() returns the invalid character. Since this is treated as signed, the check >=0 misses unportable characters, which are not in us-ascii but in ISO8859-15 or UTF-8. >How-To-Repeat: - Use e.g. ISO8859-15 or UTF-8 as input charset. - execute: pathchk -p "/homeä/öön/foo/öbaör" - observe: no error is returned >Fix: Patch attached with submission follows: --- pathchk.c.orig 2012-03-12 23:37:55.000000000 +0100 +++ pathchk.c 2012-03-12 23:39:24.000000000 +0100 @@ -142,7 +142,7 @@ goto bad; } - if (pflag && (badch = portable(p)) >= 0) { + if (pflag && (badch = portable(p)) != 0) { warnx("%s: %s: component contains non-portable " "character `%c'", path, p, badch); goto bad; @@ -201,5 +201,5 @@ if (path[s] != '\0') return (path[s]); printf("bar:%s\n",path); - return (-1); + return (0); } >Release-Note: >Audit-Trail: >Unformatted: