From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: vapnik spaknik Newsgroups: gmane.lisp.guile.user Subject: system command output different in guile than on command line Date: Tue, 4 Aug 2020 21:34:22 +0000 (UTC) Message-ID: <1155809260.1393834.1596576862334@mail.yahoo.com> References: <1155809260.1393834.1596576862334.ref@mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20554"; 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 02:53:32 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 1k37gS-0005FY-2k for guile-user@m.gmane-mx.org; Wed, 05 Aug 2020 02:53:32 +0200 Original-Received: from localhost ([::1]:56430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k37gQ-00059G-T7 for guile-user@m.gmane-mx.org; Tue, 04 Aug 2020 20:53:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k34Zs-0006pw-ER for guile-user@gnu.org; Tue, 04 Aug 2020 17:34:32 -0400 Original-Received: from sonic305-21.consmr.mail.gq1.yahoo.com ([98.137.64.84]:35790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k34Zp-0004eB-D7 for guile-user@gnu.org; Tue, 04 Aug 2020 17:34:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c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VTdzy77S.ifewUAPCbFo2ZreBMq.gyflAPrFr20gXzc6PMkZYxpUVZKfJcyEEfbVo9_z4 ZFZ3cJQF5zY_JRjQpmrhz9fGBqYMnIqasMgRkH8l8jKf62n926TK78rru9aE1PPKuhTELkmFuM6t .4N3XP76Sv1m5Xpi027VHAj6dfh60hZ258TA7KTjj3cl_UHtDFk4I0KlttFbjriXeY7XZaGzLOZ5 NeeNC3bNF4OCD9ZCet0q40xO.GMzJIFNdb9Dku9a8s Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.gq1.yahoo.com with HTTP; Tue, 4 Aug 2020 21:34:26 +0000 X-Mailer: WebService/1.1.16397 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.64.84; envelope-from=vapniks@yahoo.com; helo=sonic305-21.consmr.mail.gq1.yahoo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/04 17:34:26 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, 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-Mailman-Approved-At: Tue, 04 Aug 2020 20:53:22 -0400 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:16775 Archived-At: Hi, I'm trying to write some code to get the size of a diff of two 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. I've tried for other pairs of files, and the difference between the command line results and the guile results always seems to be 28. This is not too much of a problem in itself because I can just subtract 28 in my guile code, but it worries me; why the discrepancy? Are there other differences between guile system calls and the command line that I need to be aware of? Another strange thing is that if I use the pipeline procedure to do the same thing, then I get an exit code of 1 from the wc command, but it still returns the same result: (define (diffsize f1 f2) (receive (from to pids) (pipeline (list (list "/usr/bin/diff" "-ua" f1 f2) (list "/usr/bin/wc" "-c"))) (let ((rval (cons f2 (string->number (string-delete #\newline (read-delimited " " from))))) (xvals (map (compose status:exit-val cdr waitpid) pids))) (close to) (close from) (format #t "Exit values: ~a\n" xvals) rval))) guile> (diffsize "/tmp/file1" "/tmp/file2") Exit values: (0 1) ("/tmp/file2" . 243) Why?