From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762983AbbA3TqT (ORCPT ); Fri, 30 Jan 2015 14:46:19 -0500 Received: from cloud.peff.net ([50.56.180.127]:43426 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755467AbbA3TqR (ORCPT ); Fri, 30 Jan 2015 14:46:17 -0500 Date: Fri, 30 Jan 2015 14:46:15 -0500 From: Jeff King To: Junio C Hamano Cc: Git Mailing List , Josh Boyer , "Linux-Kernel@Vger. Kernel. Org" , twaugh@redhat.com, Linus Torvalds Subject: Re: [PATCH] apply: refuse touching a file beyond symlink Message-ID: <20150130194615.GA30738@peff.net> References: <20150130181153.GA25513@peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 30, 2015 at 11:42:49AM -0800, Junio C Hamano wrote: > Jeff King writes: > > > On Thu, Jan 29, 2015 at 12:45:22PM -0800, Junio C Hamano wrote: > > > >> + if (!patch->is_delete && path_is_beyond_symlink(patch->new_name)) > >> + return error(_("affected file '%s' is beyond a symbolic link"), > >> + patch->new_name); > > > > Why does this not kick in when deleting a file? > > Half-written logic, forgotten to be revisited (i.e. "ok, anything > that is not delete we can check new_name, so do that first, later > we'd deal with deletion patch and I think the way to do so is by > checking old_name, but let's make sure this case works first"). OK, I was worried I was missing something clever. :) I agree that checking patch->old_name should work in that case. -Peff