#217 Wishlist: -break_links not also breaking symlinks

closed
nobody
other (39)
5
2008-10-25
2008-01-11
No

An option like joe's -break_links is very useful when working with source files that have been hardlinked when cloning source trees in order to save disk space.

Enabling this option when editing a hardlinked file will then break the link, essentially implementing a copy-on-write mechanism.

Unfortunately, joe's currently implemented -break_links option also breaks symlinks!

I often use symlinks to edit documents stored elsewhere from within my project directories, so I certainly do not want symlinks to be broken.

What I would actually need is a combination of -break_links and --break_links: hardlinks should be broken but symlinks should not.

I therefore would really appreciate either an additional option like -break_hardlinks, or just modifying the existing -break_links to not delete the working file before writing back if it turns out to be a symlink (because no-one wants to break symlinks in most situations anyway).

Discussion

  • Guenther Brunthaler

    Logged In: YES
    user_id=780255
    Originator: YES

    To simplify any other potentially conflicting needs on that issue, it might be the easiest solution to add 2 options: -break_hardlinks and -break_symlinks. -break_links could then be considered a shortcut for specifying both -break_hardlinks and -break_symlinks.

     
  • Guenther Brunthaler

    Logged In: YES
    user_id=780255
    Originator: YES

    To clarify what I mean, here is pseudo-code for implementing all three options:

    procedure writeback_changes(filename, new_text, options)
    if "-break_links" in options then
    if exists(filename) then
    unlink filename
    endif
    else if "-break_hardlinks" in options then
    if exists(filename) and not is_symlink(filename) then
    unlink filename
    endif
    else if "-break_symlinks" in options then
    if exists(filename) and is_symlink(filename) then
    unlink filename
    endif
    endif
    open out_fh, filename, mode_write + mode_truncate_if_exists
    write(out_fh, new_text)
    close out_fh
    end

     
  • Joe Allen

    Joe Allen - 2008-10-25

    I've added -break_hardlinks which does not break symbolic links. -break_links breaks both hard links and symbolic links.

     
  • Joe Allen

    Joe Allen - 2008-10-25
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks