From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: vapnik spaknik via General Guile related discussions Newsgroups: gmane.lisp.guile.user Subject: Re: system command output different in guile than on command line Date: Wed, 5 Aug 2020 11:27:30 +0000 (UTC) Message-ID: <1535616889.169339.1596626850371@mail.yahoo.com> References: <1155809260.1393834.1596576862334.ref@mail.yahoo.com> <1155809260.1393834.1596576862334@mail.yahoo.com> Reply-To: vapnik spaknik Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9246"; mail-complaints-to="usenet@ciao.gmane.io" To: guile users mailing list Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Aug 05 13:27:52 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k3HaJ-0002H3-LE for guile-user@m.gmane-mx.org; Wed, 05 Aug 2020 13:27:51 +0200 Original-Received: from localhost ([::1]:36852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3HaI-0006Uf-Fd for guile-user@m.gmane-mx.org; Wed, 05 Aug 2020 07:27:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Ha8-0006UY-Oh for guile-user@gnu.org; Wed, 05 Aug 2020 07:27:40 -0400 Original-Received: from sonic311-23.consmr.mail.gq1.yahoo.com ([98.137.65.204]:37261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3Ha5-0004GE-TW for guile-user@gnu.org; Wed, 05 Aug 2020 07:27:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1596626855; bh=gNOxGlynBL2pVa3SUjelSbYzDGTC8iTgxVbDgkfYi04=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject; b=gNKfkeWE8A8twYWs16l0h0TcBxQKqrTeF26wvpbrAm1CQnL0o0B5cjDPjWM0cwfcgtTNiK9U2YkdGnJdwHhBa0hn2gAobAGoQHrYNQyKiKKQEGdVrL/pqT6zslFA1sfHI6U7Y7W5VL4PUCLu5QYRjaRjoTB7GQZQRR1Gc4H6XLerVqbKQuFnWZVgKnTexn9Qn5miNPgC843BWMCkhvYvetnPWSIfehH0lNsm7mVstJUN1EhpBAEI/SvtxkNGtdMBTPJNsl8reMwfN1DKo9h5W1/Y9Fl0ootJ7uLn/BAhQuvm8Z4aOp4Nv6kS/mHBQsM1m9HdqDF6YgDlXAmDhO5BDg== X-YMail-OSG: fUuHEEEVM1llDKzCrWnOoHnCoQ4XITIYfQWmsvWiFpVZuO8zLQHSKDrqov1A4nd qepdg3owejny4peNmV6rDDzvA.YH.MKQTmKq0L5oPgYnmfCUYn_rW_81SpFuKrPLb6xYzCcLCDD. CwiSsCjzLWuJg0vVN0IQIXSHFo8SdcXTZNzohdYbEXwMMQ9BXaNmyL3bl5Um526Egbl56gsu5j5F 6ifDWDBFt9PGH8GcX7scq7J1xU_Y8JXKICVvGondZy_aiB8iOiZM8oDWgRApvPQFM0Io2sffk6UV q0C_dmWV27CZDJabpXX_sF_CB.0SP_ovhxL3rRg5ccNxPkfn9Je6YraJCmhFDS6sqccKyaJ43tW. IzYBvh_JLihwDFMd2ojPN3TgCBLRNnjV9TwuMmysuA8nc5uoeK6PmYw1c0LjxTRqK5i4_tPfy2vq HnqULBoldKA3xidSJb29THZFjxP16FxT6p9_X8xFoG00pRn1_5qQWW9DpDPoHCB1m8ngftT_cFK1 5bozLBG8H20xNL6Ee.lPwZCQpbh6jXHy4sa4mUZEURR53JDLwSAMX1KRNTcoIdwFn5u.OllJZvOI expp_HdYLpfci27.dtahRVcnkRr_9ECs16yYdvhWdDwAexiPU_SXtLAMrJ6rFm6msUINXHpryCA5 qMYxH1lMIxRkchaameMleirB3RxqWEby4.Pc1k7ySOTLhV2p4Xp5wNRxhdYQN9IKYtAP3tsQDTh0 X36.Vg6nBE0yKXxSX2rNFx8Y2HGa1N7aDSXCM8Z9xkEmX7hLv052bVFwlaY5BDS51FApLrJ3wk44 PBVy8qL_aklBA94wm_UsFOKQ3r82yXwiTYdiJ3.2I6 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.gq1.yahoo.com with HTTP; Wed, 5 Aug 2020 11:27:35 +0000 In-Reply-To: <1155809260.1393834.1596576862334@mail.yahoo.com> X-Mailer: WebService/1.1.16436 YMailNodin Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/83.0.4103.61 Chrome/83.0.4103.61 Safari/537.36 Received-SPF: pass client-ip=98.137.65.204; envelope-from=vapniks@yahoo.com; helo=sonic311-23.consmr.mail.gq1.yahoo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/05 07:27:35 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16777 Archived-At: =20 On Tuesday, August 4, 2020, 10:34:22 PM GMT+1, vapnik spaknik wrote: >Hi, >=C2=A0 =C2=A0 I'm trying to write some code to get the size of a diff of t= wo files. >If I run the following pipeline in my zsh shell: > >> diff -ua /tmp/file1 /tmp/file2 | wc -c > >it prints 215 >However when I run the following in guile: > >guile> (system "diff -ua /tmp/file1 /tmp/file2 | wc -c") > >it prints 243. OK... I was being stupid. The shell command that I actually ran was: diff -= ua file1 file2 | wc -c i.e. without the directories in the paths since I was running from within /= tmp This meant the command I ran in the shell was slightly different than the o= ne ran in guile, and hence the difference in diffs. However, I'm still perplexed by the non-zero error code returned in the pip= eline: >Another strange thing is that if I use the pipeline procedure to do the sa= me thing, then I get an exit code of 1 >from the wc command, but it still r= eturns the same result: >(define (diffsize f1 f2) >=C2=A0 (receive (from to pids) >=C2=A0 =C2=A0 =C2=A0 (pipeline (list (list "/usr/bin/diff" "-ua" f1 f2) >=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 (list "/usr/bin= /wc" "-c"))) >=C2=A0 =C2=A0 (let ((rval (cons f2 (string->number >=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 (string-de= lete #\newline >=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 (read-delimited " " from))))) >=C2=A0=C2=A0=C2=A0 =C2=A0 (xvals (map (compose status:exit-val cdr waitpid= ) pids))) >=C2=A0 =C2=A0 =C2=A0 (close to) >=C2=A0 =C2=A0 =C2=A0 (close from) >=C2=A0 =C2=A0 =C2=A0 (format #t "Exit values: ~a\n" xvals) >=C2=A0 =C2=A0 =C2=A0 rval))) > >guile> (diffsize "/tmp/file1" "/tmp/file2") >Exit values: (0 1) >("/tmp/file2" . 243) > >Why? =20