From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alexey Veretennikov Newsgroups: gmane.emacs.devel Subject: Re: [elpa] master 8650a52 2/2: Issue #18: files considered different if they have different sizes Date: Mon, 26 Dec 2016 18:03:23 +0100 Message-ID: References: <20161226141926.26964.59272@vcs.savannah.gnu.org> <20161226141927.3D0D3220088@vcs.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1482771868 14103 195.159.176.226 (26 Dec 2016 17:04:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Dec 2016 17:04:28 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 26 18:04:24 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLYh6-00028f-Mn for ged-emacs-devel@m.gmane.org; Mon, 26 Dec 2016 18:04:16 +0100 Original-Received: from localhost ([::1]:51085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLYhB-0004px-Hf for ged-emacs-devel@m.gmane.org; Mon, 26 Dec 2016 12:04:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLYgN-0004UL-Ow for emacs-devel@gnu.org; Mon, 26 Dec 2016 12:03:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLYgI-0007Vc-Ts for emacs-devel@gnu.org; Mon, 26 Dec 2016 12:03:31 -0500 Original-Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:35382) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cLYgI-0007Un-M7 for emacs-devel@gnu.org; Mon, 26 Dec 2016 12:03:26 -0500 Original-Received: by mail-lf0-x243.google.com with SMTP id x140so11463955lfa.2 for ; Mon, 26 Dec 2016 09:03:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ivlTFzrB+U0R3LLx3MAgEf3RxZyRbOPGn28MSi6aFR0=; b=ooXgNi+vR8iuzFFrAlBzIIHKxGVhu9OuAHbBogfeEmYSjLX4kQ88HwTanGoI7M/vZe v4noJiUj/qfZpWckXyAR+JHK27kjGWK4jZoru1g+YJuxT3rFEC6e7vdxOpUZz+SWOCli ujm6nwHEIuJxVbhAV3CDY2il518r7Y4ZvA7sABw0wcGdt6u2ApfAFTgRV0YhWp0AJ4xl OuSmQqqb7nHLnRmOuWD+H6pBaG83TaVzt9TjGxj2tH2uRnEKlgNdvD8HNZ8QhUVYzelz dqnAVWZtInUenBwaGuW1HhMjHw4ofbvjnwvbbpKy0ZLOXSnPSSq+fbRniKVGySSCGAVG PcxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=ivlTFzrB+U0R3LLx3MAgEf3RxZyRbOPGn28MSi6aFR0=; b=G3ioM+c0mpPMsDgNbjx6JAWPXqnbUT3hiNU5sMpZzN953c14bVjiDU2lMoadphnm34 swLHYBOGh0F5oKGvCWQBA421vHtfSPw84P4rsEK1qigKnrNbRY9nn/bKgEmsEPbLMSQp 34y/8N4BO+FQeZbVLvpgBPfzJb+PJN4+WPgBjHcMk/pOIgDCoH1PdbjIN3ZDktd6fMjR 2z//7a3YG2ZnNeNno7f8A05zM/Je/oA4b6AOjOGKP3xBQ8Mlffv0L7Sxxt0+MjRfs0pB 5u9omvN+0HE9vM7REzO5kKOGUpJMS/u4YRiEM4d+OyWA3tgsZbJdrepTwffjkM403rB5 tlXA== X-Gm-Message-State: AIkVDXI0D8tbryaedIV0Ek1uJRXvtcdHHkD/Cg1xVQYhLLCHdDSV4BWiQ9AB81A72hLAAA== X-Received: by 10.25.19.170 with SMTP id 42mr8067788lft.174.1482771805131; Mon, 26 Dec 2016 09:03:25 -0800 (PST) Original-Received: from Mac-34363bcb361c.lan (c-407fe055.030-62-73746f71.cust.bredbandsbolaget.se. [85.224.127.64]) by smtp.googlemail.com with ESMTPSA id a79sm4508940ljb.46.2016.12.26.09.03.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Dec 2016 09:03:24 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Mon, 26 Dec 2016 09:40:10 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::243 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210820 Archived-At: Thanks! I'll experiment with process-file. Stefan Monnier writes: >> + (diff-cmd (concat diff-command " -q" " " >> + (ztree-quotify-string file1-untrampified) >> + " " >> + (ztree-quotify-string file2-untrampified)))) >> + (if (and >> + (= (nth 7 (file-attributes file1-untrampified)) >> + (nth 7 (file-attributes file2-untrampified))) >> + (> (length (shell-command-to-string diff-cmd)) 2)) > > The function `process-file` should be able to do a better job than > shell-command-to-string (among other things, no need for "quotify"). > > You'll probably want to run it something like > > (let* ((file1 (file-name-directory (expand-file-name file1))) > (file2 (file-name-directory (expand-file-name file2))) > (default-directory (file-name-directory file1)) > (file1 (file-relative-name file1)) > (file2 (file-relative-name file2)) > (exit-code > (process-file diff-command nil nil nil > "-q" file1 file2))) > (if (and (numberp exit-code) (= exit-code 0)) > 'same 'diff)) > > BTW, a file with name > > hello"; rm -rf ~/. > > will probably not do what you wanted. Using process-file should fix > this problem since it doesn't need to quote anything. But if you insist > on using a shell command, then just use shell-quote-argument instead of > ztree-quotify-string. > > > Stefan -- Br, /Alexey