Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues in the logic of copying/moving symlinks to dirs #2617

Open
spnethw opened this issue Jan 6, 2025 · 0 comments
Open

Issues in the logic of copying/moving symlinks to dirs #2617

spnethw opened this issue Jan 6, 2025 · 0 comments

Comments

@spnethw
Copy link
Contributor

spnethw commented Jan 6, 2025

@elfmz

Обнаружились проблемы в логике копирования/переноса символических ссылок на папки.
Предположим, имеем такую структуру:

[~/test-src]
    ├─folder
    │     └─ file
    │
    └─dirlink -> folder

[~/test-dst]


A. При попытке копирования только ~/test-src/dirlink в ~/test-dst/:
A.1. В режиме "Smartly copy link or target file" — ничего не происходит, директория ~/test-dst/ пуста.

A.2. В режиме "Always copy target file" —

╔══════════════════ Error ═══════════════════╗
║     Нет такого файла или каталога (2)      ║
║                Cannot copy                 ║
║               "dirlink/file"               ║
║                     to                     ║
║         "~/test-dst/dirlink/file"          ║
╟────────────────────────────────────────────╢
║ { Retry } [ Skip ] [ Skip all ] [ Cancel ] ║
╚════════════════════════════════════════════╝

B. При попытке переноса только ~/test-src/dirlink в ~/test-dst/:
B.1. В режиме "Smartly copy link or target file" —

╔══════════════════ Error ═══════════════════╗
║            Это не каталог (20)             ║
║           Cannot delete the file           ║
║                  dirlink                   ║
╟────────────────────────────────────────────╢
║ { Retry } [ Skip ] [ Skip all ] [ Cancel ] ║
╚════════════════════════════════════════════╝

B.2. В режиме "Always copy target file" —

╔══════════════════ Error ═══════════════════╗
║     Нет такого файла или каталога (2)      ║
║                Cannot move                 ║
║               "dirlink/file"               ║
║                     to                     ║
║         "~/test-dst/dirlink/file"          ║
╟────────────────────────────────────────────╢
║ { Retry } [ Skip ] [ Skip all ] [ Cancel ] ║
╚════════════════════════════════════════════╝

C. При попытке переноса ~/test-src/dirlink И ~/test-src/folder в ~/test-dst/:
C.1. В режиме "Smartly copy link or target file" —

сначала выдаётся ошибка:

╔══════════════════ Error ═══════════════════╗
║            Это не каталог (20)             ║
║           Cannot delete the file           ║
║                  dirlink                   ║
╟────────────────────────────────────────────╢
║ { Retry } [ Skip ] [ Skip all ] [ Cancel ] ║
╚════════════════════════════════════════════╝

после чего в ~/test-dst/, вроде бы, структура правильная, но в исходной директории осталась неудалённой битая ссылка ~/test-src/dirlink

C.2. В режиме "Always copy target file" —


╔══════════════════ Error ═══════════════════╗
║     Нет такого файла или каталога (2)      ║
║                Cannot move                 ║
║               "dirlink/file"               ║
║                     to                     ║
║         "~/test-dst/dirlink/file"          ║
╟────────────────────────────────────────────╢
║ { Retry } [ Skip ] [ Skip all ] [ Cancel ] ║
╚════════════════════════════════════════════╝

после чего в ~/test-dst/ переносится директория folder (вместе с файлом file), а ссылка ~/test-src/dirlink остаётся в исходной директории битой.


D. При попытке копирования ВСЕЙ ~/test-src в ~/test-dst/:
D.1. В режиме "Smartly copy link or target file" — копируется без проблем.

D.2. В режиме "Always copy target file" —

╔═════════════════════ Error ═════════════════════╗
║        Нет такого файла или каталога (2)        ║
║                   Cannot copy                   ║
║             "test-src/dirlink/file"             ║
║                       to                        ║
║       "~/test-dst/test-src/dirlink/file"        ║
╟─────────────────────────────────────────────────╢
║   { Retry } [ Skip ] [ Skip all ] [ Cancel ]    ║
╚═════════════════════════════════════════════════╝

симлинк не копируется, конечная структура дерева имеет вид:


[~/test-dst]
 └─test-src
   └─folder
      └─file

E. При попытке переноса ВСЕЙ ~/test-src в ~/test-dst/:
E.1. В режиме "Smartly copy link or target file" — ошибок не выдаёт, в ~/test-dst/ воссоздаётся верная структура, но папка ~/test-src и (уже битый) симлинк ~/test-src/dirlink остаются неудалёнными.

E.2. В режиме "Always copy target file" —


╔════════════════════ Error ═════════════════════╗
║       Нет такого файла или каталога (2)        ║
║                  Cannot move                   ║
║             "test-src/dirlnk/file"             ║
║                       to                       ║
║       "~/test-dst/test-src/dirlnk/file"        ║
╟────────────────────────────────────────────────╢
║   { Retry } [ Skip ] [ Skip all ] [ Cancel ]   ║
╚════════════════════════════════════════════════╝

дальнейший результат аналогичен E.1.


На самом деле, не совсем ясно, как правильно поступать в каждом из этих случаев.

Но в случае умного копирования, кмк, если имеем симлинк на директорию и она не копируется в той же операции заодно, то нужно целиком всю целевую директорию симлинка копировать под именем симлинка — собственно, как опция "разыменовывать ссылки" в mc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant