Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2012 22:43:56 GMT
From:      Nicolas Rachinsky <nicolas-2012@rachinsky.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/165988: pathchk -p does not work correctly with some locales [PATCH}
Message-ID:  <201203122243.q2CMhuDn054261@red.freebsd.org>
Resent-Message-ID: <201203122250.q2CMoFHA028657@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203122243.q2CMhuDn054261>