git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] apply: refuse touching a file beyond symlink

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 30, 2015, 21:50 UTC
Message-ID
<xmqqd25waqf9.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150130204805.GA10616@peff.net>
Jeff King <peff@peff.net> writes:
> But could we instead pull this check to just before the write-out time?
> That is, to let any horrible thing happen in-core, as long as what we
> write out to the index and the filesystem is sane?

The check in-core is somewhat tricky, because we would need to (1) catch a patch that creates a symlink and also a file as if that new symlink is a directory and (2) allow a patch that removes a symlink and also a file in a new directory at the location removed symlink used to occupy.

For (1) we need to see if there is a patch in the entire input that creates a symbolic link and reject the input. For (2) we need to see if there is a patch that removes the symbolic link. (1) cannot be caught with the approach based on fn_table[], which is inherently meant to help incremental application, that is oblivious to a path that will materialize after applying a later patch in the input.

Let me think about it a bit more. The fix probably needs to abandon depending on fn_table[] stuff, if we want to do in the "sanity check the input and compute the final state all in-core" route.

Previous: Junio C HamanoNext: Andreas Gruenbacher
Message 34 of 35 in “patch-2.7.3 no longer applies relative symbolic link patches”
  1. Josh BoyerJan 26, 2015
  2. Josh BoyerJan 26, 2015
  3. Linus TorvaldsJan 26, 2015
  4. David KastrupJan 26, 2015
  5. Josh BoyerJan 26, 2015
  6. Linus TorvaldsJan 26, 2015
  7. Junio C HamanoJan 26, 2015
  8. Linus TorvaldsJan 26, 2015
  9. Andreas GruenbacherJan 27, 2015
  10. Andreas GruenbacherJan 31, 2015
  11. Josh BoyerJan 26, 2015
  12. Junio C HamanoJan 27, 2015
  13. Junio C HamanoJan 27, 2015
  14. Junio C HamanoJan 29, 2015
  15. Junio C HamanoJan 29, 2015
  16. apply: refuse touching a file beyond symlinkJunio C Hamano, Jan 29, 2015
  17. Stefan BellerJan 29, 2015
  18. 2/1 apply: reject input that touches outside $cwdJunio C Hamano, Jan 29, 2015
  19. Jeff KingJan 30, 2015
  20. Junio C HamanoJan 30, 2015
  21. Jeff KingJan 30, 2015
  22. Christian CouderJan 30, 2015
  23. Jeff KingJan 30, 2015
  24. Junio C HamanoJan 30, 2015
  25. Jeff KingJan 30, 2015
  26. Junio C HamanoJan 30, 2015
  27. Jeff KingJan 30, 2015
  28. Junio C HamanoJan 30, 2015
  29. Junio C HamanoJan 30, 2015
  30. Jeff KingJan 30, 2015
  31. Junio C HamanoJan 30, 2015
  32. Jeff KingJan 30, 2015
  33. Junio C HamanoJan 30, 2015
  34. Junio C HamanoJan 30, 2015
  35. Andreas GruenbacherJan 27, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.