From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kirill Smelkov Subject: [BUG, PATCH v3 0/3] Fix {blame,cat-file} --textconv for cases with symlinks Date: Fri, 24 Sep 2010 22:24:07 +0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: git@vger.kernel.org, Axel Bonnet , =?UTF-8?q?Cl=C3=A9ment=20Poulain?= , Diane Gasselin , Matthieu Moy , Jeff King , Kirill Smelkov To: Junio C Hamano X-From: git-owner@vger.kernel.org Fri Sep 24 20:22:50 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OzCv1-0002xZ-OZ for gcvg-git-2@lo.gmane.org; Fri, 24 Sep 2010 20:22:48 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932328Ab0IXSWh (ORCPT ); Fri, 24 Sep 2010 14:22:37 -0400 Received: from landau.phys.spbu.ru ([195.19.235.38]:58598 "EHLO landau.phys.spbu.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932322Ab0IXSWf (ORCPT ); Fri, 24 Sep 2010 14:22:35 -0400 Received: by landau.phys.spbu.ru (Postfix, from userid 506) id 3E715FF719; Fri, 24 Sep 2010 22:22:34 +0400 (MSD) Received: from kirr by landau.phys.spbu.ru with local (Exim 4.72) (envelope-from ) id 1OzCwX-0001U6-Po; Fri, 24 Sep 2010 22:24:22 +0400 X-Mailer: git-send-email 1.7.3.rc2 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Recently I've spot a bug in git blame --textconv, which was wrongly calling pdftotext (my *.pdf conversion program) on a symlink.pdf, and I was getting something like $ git blame -C -C regular-file.pdf Error: May not be a PDF file (continuing anyway) Error: PDF file is damaged - attempting to reconstruct xref table... Error: Couldn't find trailer dictionary Error: Couldn't read xref table Warning: program returned non-zero exit code #1 fatal: unable to read files to diff That errors come from pdftotext run on symlink.pdf being extracted to /tmp/ with one-line plain-text content pointing to link destination. Please apply and thanks, Kirill v3: o Slightly changed patches descriptions as per comment by Matthieu, and added Matthieu's Reviewed-by. v2: o Incorporated suggestions by Matthieu and Jeff (details in each patch) Kirill Smelkov (3): tests: Prepare --textconv tests for correctly-failing conversion program blame,cat-file: Demonstrate --textconv is wrongly running converter on symlinks blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664'' builtin.h | 2 +- builtin/blame.c | 33 ++++++++++++++------- builtin/cat-file.c | 2 +- sha1_name.c | 2 + t/t4042-diff-textconv-caching.sh | 25 ++++++++-------- t/t8006-blame-textconv.sh | 58 +++++++++++++++++++++++++++++++++---- t/t8007-cat-file-textconv.sh | 36 ++++++++++++++++++++--- 7 files changed, 121 insertions(+), 37 deletions(-) -- 1.7.3.rc2