From owner-freebsd-standards@FreeBSD.ORG Mon Nov 20 11:10:12 2006 Return-Path: X-Original-To: freebsd-standards@FreeBSD.org Delivered-To: freebsd-standards@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4AACD16A49E for ; Mon, 20 Nov 2006 11:10:12 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3780943DBC for ; Mon, 20 Nov 2006 11:08:14 +0000 (GMT) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (linimon@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kAKB8TXO001633 for ; Mon, 20 Nov 2006 11:08:29 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kAKB8SwJ001629 for freebsd-standards@FreeBSD.org; Mon, 20 Nov 2006 11:08:28 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 20 Nov 2006 11:08:28 GMT Message-Id: <200611201108.kAKB8SwJ001629@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: linimon set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-standards@FreeBSD.org Cc: Subject: Current problem reports assigned to you X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Nov 2006 11:10:12 -0000 Current FreeBSD problem reports Critical problems Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o bin/25542 standards /bin/sh: null char in quoted string o kern/46239 standards posix semaphore implementation errors o stand/54410 standards one-true-awk not POSIX compliant (no extended REs) o stand/82654 standards C99 long double math functions are missing o stand/94729 standards fcntl() throws undocumented ENOTTY o stand/104422 standards TCP-MD5 key length limits 6 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- o bin/21519 standards sys/dir.h should be deprecated some more o bin/24390 standards Replacing old dir-symlinks when using /bin/ln s stand/24590 standards timezone function not compatible witn Single Unix Spec s kern/28260 standards UIO_MAXIOV needs to be made public s stand/36076 standards Implementation of POSIX fuser command o stand/39256 standards snprintf/vsnprintf aren't POSIX-conformant for strings p stand/41576 standards POSIX compliance of ln(1) o stand/44425 standards getcwd() succeeds even if current dir has perm 000. o stand/46119 standards Priority problems for SCHED_OTHER using pthreads o stand/54833 standards [pcvt] more pcvt deficits o stand/54839 standards [pcvt] pcvt deficits p stand/55112 standards glob.h, glob_t's gl_pathc should be "size_t", not "int o stand/56476 standards cd9660 unicode support simple hack o stand/58676 standards grantpt(3) alters storage used by ptsname(3) s stand/62858 standards malloc(0) not C99 compliant s kern/64875 standards [libc] [patch] [feature request] add a system call: fd o stand/66357 standards make POSIX conformance problem ('sh -e' & '+' command- o stand/66531 standards _gettemp uses a far smaller set of filenames than docu o stand/70813 standards [PATCH] ls(1) not Posix compliant o stand/72006 standards floating point formating in non-C locales o stand/79056 standards regex(3) regression tests a stand/80293 standards sysconf() does not support well-defined unistd values o stand/81287 standards [PATCH]: fingerd(8) might send a line not ending in CR o stand/83845 standards [libm] [patch] add log2() and log2f() support for libm o stand/85080 standards output of long double subnormals (with printf) is wron o stand/92360 standards [headers] [patch] Missing TAB3 in kernel headers o stand/92362 standards [headers] [patch] Missing SIGPOLL in kernel headers o kern/93705 standards [headers] [patch] ENODATA and EGREGIOUS (for glibc com o stand/96016 standards clock_getres et al should be in o stand/96236 standards [PATCH] [POSIX] sed.1 incorrectly describes a function o stand/99517 standards Missing SIGRTMIN and SIGRTMAX signals o stand/99960 standards [Patch] [make] Add -p flag o stand/100017 standards [Patch] Add fuser(1) functionality to fstat(1) o stand/104743 standards Wrong values for _POSIX_ minimal limits o stand/104841 standards C99 long double square root. 35 problems total. From owner-freebsd-standards@FreeBSD.ORG Fri Nov 24 12:18:37 2006 Return-Path: X-Original-To: freebsd-standards@freebsd.org Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D3DF416A519 for ; Fri, 24 Nov 2006 12:18:37 +0000 (UTC) (envelope-from sniimi@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.228]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1A1C43D4C for ; Fri, 24 Nov 2006 12:17:55 +0000 (GMT) (envelope-from sniimi@gmail.com) Received: by wx-out-0506.google.com with SMTP id s18so775810wxc for ; Fri, 24 Nov 2006 04:18:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=WhY63R+YCitv5DVi40Bk/dTUqJ/lJuPqEX0F3TyjVPBJJeVcRLoa09QKkpoG/KCqKC5g0Wc7EoMpRDxid7x9SK9OmW3D6X5ifB82Rw9ti6h5VOBwywwrasZHNfFfXdr+OsfYD5X03hMOIGjrbuGBAW8TT6XP6ieZlJdMYOxvqY0= Received: by 10.100.37.4 with SMTP id k4mr1589274ank.1164370715985; Fri, 24 Nov 2006 04:18:35 -0800 (PST) Received: by 10.100.45.11 with HTTP; Fri, 24 Nov 2006 04:18:35 -0800 (PST) Message-ID: <7a2b18c80611240418w43776195p340d1ff49ac69786@mail.gmail.com> Date: Fri, 24 Nov 2006 21:18:35 +0900 From: "NIIMI Satoshi" Sender: sniimi@gmail.com To: freebsd-standards@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_24_2638223.1164370715927" X-Google-Sender-Auth: fe2b3e08e566bb5a Subject: type command bahaviour of FreeBSD's /bin/sh (Fwd: [issue426] hgmerge assumes FileMerge to be exist unconditionally on FreeBSD) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Nov 2006 12:18:37 -0000 ------=_Part_24_2638223.1164370715927 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline [ Please CC me when reply since I don't subscribe this list. ] Hi, FreeBSD's /bin/sh produces: | % sh -c 'type /nonexistent; echo $?' | /nonexistent: No such file or directory | 0 whereas | % bash -c 'type /nonexistent; echo $?' | bash: line 0: type: /nonexistent: not found | 1 | ksh -c 'type /nonexistent; echo $?' | /nonexistent: not found | 1 Does the current behaviour of /bin/sh's type command conform to the standards? Thanks, -- NIIMI Satoshi ---------- Forwarded message ---------- From: Giorgos Keramidas Date: 2006/11/22 1:57 Subject: Re: [issue426] hgmerge assumes FileMerge to be exist unconditionally on FreeBSD To: NIIMI Satoshi Cc: mercurial-devel@selenic.com On 2006-11-21 16:05, NIIMI Satoshi wrote: > > New submission from NIIMI Satoshi : > > There is a problem in type command of FreeBSD like: > | % sh -c 'type /nonexistent; echo $?' > | /nonexistent: No such file or directory > | 0 > > Because of the above feature (bug?), testing > "/Developer/.../FileMerge" always succeeds and used unconditionally. > I made a patch to work around this. The Single Unix Specification version 3 (c.f. page [1]) does not specify if it's an error *not* to find the 'name' argumennt of type(1), so I am not sure if this is a bug of FreeBSD's /bin/sh shell. [1] http://www.opengroup.org/onlinepubs/009695399/utilities/type.html#tag_04_150 Can you please forward this to freebsd-standards@freebsd.org too, so we can fix the bug if it is indeed a bug? - Giorgos _______________________________________________ Mercurial-devel mailing list Mercurial-devel@selenic.com http://selenic.com/mailman/listinfo/mercurial-devel ------=_Part_24_2638223.1164370715927 Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 X-Attachment-Id: 0.0.1 Content-Disposition: attachment LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjEuNC41IChGcmVl QlNEKQoKaUQ4REJRRkZZekFLMWcrVUdqR0dBN1lSQW1YMUFKMGJWNGlWazBTY1k3VWZUQmxDRllN SmNpVHlrUUNnb0NIcApPYVRaeXJ6RVAvcGhMM3l4bzUwSzJKND0KPU41STAKLS0tLS1FTkQgUEdQ IFNJR05BVFVSRS0tLS0tCgo= ------=_Part_24_2638223.1164370715927-- From owner-freebsd-standards@FreeBSD.ORG Fri Nov 24 13:21:57 2006 Return-Path: X-Original-To: freebsd-standards@FreeBSD.ORG Delivered-To: freebsd-standards@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27A9316A4A0 for ; Fri, 24 Nov 2006 13:21:57 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1CF1E43D58 for ; Fri, 24 Nov 2006 13:21:13 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (kdqted@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id kAODLm0L059665; Fri, 24 Nov 2006 14:21:54 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id kAODLlu6059664; Fri, 24 Nov 2006 14:21:47 +0100 (CET) (envelope-from olli) Date: Fri, 24 Nov 2006 14:21:47 +0100 (CET) Message-Id: <200611241321.kAODLlu6059664@lurza.secnetix.de> From: Oliver Fromme To: freebsd-standards@FreeBSD.ORG, sa2c@sa2c.net In-Reply-To: <7a2b18c80611240418w43776195p340d1ff49ac69786@mail.gmail.com> X-Newsgroups: list.freebsd-standards User-Agent: tin/1.8.2-20060425 ("Shillay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 24 Nov 2006 14:21:54 +0100 (CET) Cc: Subject: Re: type command bahaviour of FreeBSD's /bin/sh (Fwd: [issue426] ?hgmerge assumes FileMerge to be exist unconditionally on FreeBSD) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-standards@FreeBSD.ORG, sa2c@sa2c.net List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Nov 2006 13:21:57 -0000 NIIMI Satoshi wrote: > FreeBSD's /bin/sh produces: > | % sh -c 'type /nonexistent; echo $?' > | /nonexistent: No such file or directory > | 0 Note that the "type" utility is normally not called with a full path, but with a command name. In that case it behaves correctly: $ type asdfg asdfg: not found $ echo $? 127 If you have a full path name and need to know whether it exists, you should rather use the "test" utility instead of "type". The purpose of "type" is to find out how a _name_ would be interpreted when given as a command (i.e. keyword, builtin, alias, shell function or $PATH expansion). > Does the current behaviour of /bin/sh's type command conform to the standards? SUSv3/POSIX2001 is not very clear, unfortunately. It doesn't exactly explain how the "type" utility should behave when given a non-existing absolute path. I tend to believe that it's not a bug in FreeBSD, but rather a valid interpretation of the standard. > > Because of the above feature (bug?), testing > > "/Developer/.../FileMerge" always succeeds and used unconditionally. > > I made a patch to work around this. As I said above, it is _wrong_ to use "type" for testing the existence of a file whose full path is known. Use "test" (a.k.a. "[") for that purpose: if [ -f "$FULLPATH" ]; then # ... found else # ... not found fi Even if you need to find out whether a name expands to an external command, it is _not_ sufficient to only check the return code of "type". You also need to parse the output in order to check whether it returned a full path (as opposite to "shell builtin", "alias" or whatever). In fact it is non-trivial, because the output format of the "type" builtin is not standardized and varies between shells. Therefore, if you need to find a command in the $PATH list, then it's better to do that yourself using a shell loop, like this: FULLPATH="" OLD_IFS="$IFS" IFS=":" for DIR in $PATH; do if [ -x "$DIR/$COMMAND" ]; then FULLPATH="$DIR/$COMMAND" break fi done IFS="$OLD_IFS" if [ -n "$FULLPATH" ]; then echo "Found: $FULLPATH" else echo "$COMMAND not found" fi My conclusion is that you should _never_ use "type" in portable shell scripts. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way.