Giter Site home page Giter Site logo

Comments (1)

landley avatar landley commented on August 14, 2024

Hmmm, reproduced. Yeah, I should fix it and add a test.

If you add -k to the extract (Which I just noticed is in the usage: line but not the help text, it's in debian's tar man page as "keep old files when extracting") it'll sort of work? As in you'll have a file at the end, but it'll still error.

Sigh, there's -k and there's --overwrite, the first of which says that existing files win and the second says write to existing files (which won't break existing hardlinks and will write through symlinks and is generally iffy from a security perspective), and it hasn't got a lot of testing because --overwrite doesn't imply -k so it looks like it'll delete anyway. I need to add tests.

But to fix this test problem, I think I need to add a special case for "hardlink to itself" here? Ordinarily a link target (hard or soft) is going to need to unlink the old one to create the new one (otherwise the syscall will fail), and because the above "opening and writing to whatever's already there is probably not great from a security perspective, so you need to explicitly request that behavior" we don't have a "try it and fall back to unlink-and-retry" codepath.

Sigh: add -k to help text. Add --overwrite to help text. Fix --overwrite to imply -k. Add special case for hardlink-to-self. Did I miss any todo items?

from toybox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.