From owner-freebsd-questions@FreeBSD.ORG Wed Jan 9 07:53:06 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BCDE6C6A for ; Wed, 9 Jan 2013 07:53:06 +0000 (UTC) (envelope-from jack.mclauren@yahoo.com) Received: from nm9-vm0.bullet.mail.bf1.yahoo.com (nm9-vm0.bullet.mail.bf1.yahoo.com [98.139.213.154]) by mx1.freebsd.org (Postfix) with SMTP id 464F183E for ; Wed, 9 Jan 2013 07:53:05 +0000 (UTC) Received: from [98.139.214.32] by nm9.bullet.mail.bf1.yahoo.com with NNFMP; 09 Jan 2013 07:53:05 -0000 Received: from [98.139.212.196] by tm15.bullet.mail.bf1.yahoo.com with NNFMP; 09 Jan 2013 07:53:05 -0000 Received: from [127.0.0.1] by omp1005.mail.bf1.yahoo.com with NNFMP; 09 Jan 2013 07:53:05 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 131063.10341.bm@omp1005.mail.bf1.yahoo.com Received: (qmail 29220 invoked by uid 60001); 9 Jan 2013 07:53:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1357717984; bh=jPlJsraqXJ37neyq6za/fEx8uvpl1thMtVLdtj814f0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=ztB6dp9mTarku9UIdYCS8Jtj+8a1jVh1qPv9PaUTWl38IE0lyYfl2+YxTfSmlJoCaSxZF0n4h+NVnaXbaS6pn/ud26FjUdRO6nWq4g7sDfj5uKv5HZwwvKRUrs0dh0WAo3eqsRjC3OkaafgFYv3qB3ddpa74i7JFehCUZAMrK1o= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=ssIxh2Rh/MY1Uzd3PXLnZTp1zN4XRX7JaHxlsne+WeadfdVyQoSJGQpPJsUXRGTPWNZl+eoLe/pcGjlPZ8VK+2711pRtRNwd0hAQ6+aILcSjuFDvCbaKFjf8nlkUYIAJDyARcnZ2bTJTWAoFQvApKNbw6h7l85X+AuU2lET0WVw=; X-YMail-OSG: V49nFBwVM1lsAZzVgLFTJuksj50p4GZu_2OITPqDy1aaI5B 5dDMciLHNllL1wy6zSC9SHKt2FLOZuoiefVL..AwUJUguhREHUCVtEWrnFb0 r5nPOzz2cuqqMESx99I02G_I5aosQCF249U9yNUfqGETlWzvejPmvDghxx2G dsiU_WuW7WLFvRRLkEAyV22XlhRocACVU4V9LndPAVnG6.5nza8xkmPZ5eo5 ow_HrMxf2uQBt31uK0LWuQeHvqIX6sNEUmLybWG1r2ZabAMO2sKWt3HaROTn s83mpFAtEDUjJqnNzrxLsD9v5YZurANT09L.qRZ4ylP6wuxqSIFDB7W02kE6 syAbs6amx4xUSC02yUnIw7LJKRDy664AeEPEGkfOkmhB_2VwzHF_O8grycKd ecALJMLEgbMfjuqHzAQx4e_9FOPrI0L3zlHB8gui6KJTRtDZZh5hh_f9Bb14 - Received: from [89.165.120.140] by web160101.mail.bf1.yahoo.com via HTTP; Tue, 08 Jan 2013 23:53:04 PST X-Rocket-MIMEInfo: 001.001, SGkgZ3V5cwoKSSBoYXZlIGEgZnJlZUJTRCA4LjIgYW1kNjQgb24gbXkgc3lzdGVtIGFuZCBJJ20gdXNpbmcgZ25vbWXCoGVudmlyb25tZW50LiBCdXQgYWZ0ZXIgYcKgZmV3wqBzZWNvbmRzIG15IFVTQsKga2V5Ym9hcmQgYW5kwqDCoFBTLzIgbW91c2UgaGFuZyB1cCAhISEKCldoYXQgc2hvdWxkIEkgZG8gPwoKVGhhbmtzIGluIGFkdmFuY2UgLi4uATABAQEB X-Mailer: YahooMailWebService/0.8.130.494 Message-ID: <1357717984.93950.YahooMailNeo@web160101.mail.bf1.yahoo.com> Date: Tue, 8 Jan 2013 23:53:04 -0800 (PST) From: Jack Mc Lauren Subject: keyboard and mouse problem To: FreeBSD Global Users Mailing List MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Jack Mc Lauren List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2013 07:53:06 -0000 Hi guys=0A=0AI have a freeBSD 8.2 amd64 on my system and I'm using gnome=A0= environment. But after a=A0few=A0seconds my USB=A0keyboard and=A0=A0PS/2 mo= use hang up !!!=0A=0AWhat should I do ?=0A=0AThanks in advance ... From owner-freebsd-questions@FreeBSD.ORG Wed Jan 9 07:55:53 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7005DD3C for ; Wed, 9 Jan 2013 07:55:53 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from asbnvacz-mailrelay01.megapath.net (asbnvacz-mailrelay01.megapath.net [207.145.128.243]) by mx1.freebsd.org (Postfix) with ESMTP id 3861D86E for ; Wed, 9 Jan 2013 07:55:53 +0000 (UTC) Received: from mail7.sea5.speakeasy.net (mail7.sea5.speakeasy.net [69.17.117.52]) by asbnvacz-mailrelay01.megapath.net (Postfix) with ESMTP id 45215A7161D for ; Wed, 9 Jan 2013 02:55:52 -0500 (EST) Received: (qmail 11792 invoked from network); 9 Jan 2013 07:55:51 -0000 Received: by simscan 1.4.0 ppid: 11104, pid: 25084, t: 0.4111s scanners: clamav: 0.88.2/m:52/d:13513 Received: from unknown (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail7.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 9 Jan 2013 07:55:51 -0000 Received: from lowell-desk.lan (lowell-desk.lan [172.30.250.8]) by be-well.ilk.org (Postfix) with ESMTP id 668D933C1D; Wed, 9 Jan 2013 02:55:45 -0500 (EST) Received: by lowell-desk.lan (Postfix, from userid 1147) id 1652639829; Wed, 9 Jan 2013 02:55:45 -0500 (EST) From: Lowell Gilbert To: Fbsd8 Subject: Re: sh script problem with capturing return code References: <50EC9009.3030305@a1poweruser.com> <20130108224626.8c2d89cd.freebsd@edvax.de> <50EC99F2.3020404@a1poweruser.com> Date: Wed, 09 Jan 2013 02:55:44 -0500 In-Reply-To: <50EC99F2.3020404@a1poweruser.com> (fbsd8@a1poweruser.com's message of "Tue, 08 Jan 2013 17:13:06 -0500") Message-ID: <44d2xevlhb.fsf@lowell-desk.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: FreeBSD questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: FreeBSD questions List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2013 07:55:53 -0000 Fbsd8 writes: > Polytropon wrote: >> On Tue, 08 Jan 2013 16:30:49 -0500, Fbsd8 wrote: >>> I can not get the return code from mtree to control >>> the displaying of a error message. >>> >>> The mtree at the end of the script does function correctly >>> because I can tell from the printed output. >>> >>> When mtree prints comments saying "extra" that means the directory >>> being read does not match the specification file. return code >>> should be Not equal to zero. >>> >>> And when they do match IE: no mtree comments printed, that should >>> be a return code of zero. >>> >>> I tried 2 different ways to capture the return code to no joy. >>> What I am doing wrong? >>> >>> #! /bin/sh >>> flavor="/a/mtree.std" >>> echo "flavor = ${flavor}" >>> /bin/cat << EOF | >>> /set type=dir uname=root gname=wheel >>> . >>> etc ignore >>> .. >>> root ignore >>> .. >>> usr >>> home ignore >>> .. >>> local >>> etc ignore >>> .. >>> .. >>> .. >>> .. >>> EOF >>> >>> mtree -d -u -p "${flavor}" || \ >>> echo "Error invalid directories in flavor ${flavor}." >>> >>> #mtree -d -p "${flavor}" >>> #[ $? -eq 0 ] || \ >>> # echo "Error invalid directories in flavor ${flavor}." >>> echo "return = $?" >> >> It seems that returning 0 is correct in a case as you mentioned. >> The manual at "man mtree" states: >> >> EXIT STATUS >> The mtree utility exits 0 on success, and >0 if an error occurs. >> >> Question: What _is_ an error here? >> >> If you use the source Luke at /usr/src/usr.sbin/mtree/mtree.c, >> you could find out what combination of options plus circumstances >> found at runtime could trigger an exit status != 0. >> >> The main() functions finishes with exit(status); where status >> is either set by functions mtree_specspec() or mtree_verifyspec(), >> or manually to 0 when -U is provided and MISMATCHEXIT (is 2) is >> encountered. >> >> Again from the manual: >> >> -u Same as -U except a status of 2 is returned if the file hierarchy >> did not match the specification. >> >> -U Modify the owner, group, permissions, and modification time of >> existing files to match the specification and create any missing >> directories or symbolic links. User, group and permissions must >> all be specified for missing directories to be created. Corrected >> mismatches are not considered errors. >> >> However, you're not using -U, but -u, so the last sentence of >> the description above should be relevant: No error per se, >> even though the status code should be 2. >> >> >> >> > Well I just tested with -U -u together no joy. > Tested with -U no joy. > > My read of the above is -u should cause a return code of 2 when the > file hierarchy does not match the specification. I don't want -U > because I am not modifying any content of the directory tree mtree is > looking at. > > I just don't get the point your trying to make. > > Oh the other hand are you saying the script code is correct to capture > the return code but using wrong options with mtree ? It works fine for me: [5023] (lowell-desk) temp> touch foo [5024] (lowell-desk) temp> mtree -c > ../out [5025] (lowell-desk) temp> if (mtree < ../out ) ; then echo yes ; else echo no ; fi yes [5026] (lowell-desk) temp> touch foo [5027] (lowell-desk) temp> if (mtree < ../out ) ; then echo yes ; else echo no ; fi foo changed modification time expected Wed Jan 9 02:42:31 2013 found Wed Jan 9 02:42:47 2013 no [5028] (lowell-desk) temp> echo $? 0 [5029] (lowell-desk) temp> mtree < ../out foo changed modification time expected Wed Jan 9 02:42:31 2013 found Wed Jan 9 02:42:47 2013 [5030] (lowell-desk) temp> echo $? 2 [5031] (lowell-desk) temp> touch temp [5032] (lowell-desk) temp> mtree -u < ../out . changed modification time expected Wed Jan 9 02:42:37 2013 found Wed Jan 9 02:49:52 2013 modified foo changed modification time expected Wed Jan 9 02:42:31 2013 found Wed Jan 9 02:42:47 2013 modified temp extra [5033] (lowell-desk) temp> echo $? 2 This is exactly what I would expect, and what you said you weren't getting. You didn't show what you ran your script on, or what the results were, so I can't tell you what you're doing wrong -- but compare my example to yours and I'm sure you'll be able to figure it out. Good luck.