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

Fix the directory pathname while moving directories #816

Merged
merged 2 commits into from
Aug 1, 2023
Merged

Fix the directory pathname while moving directories #816

merged 2 commits into from
Aug 1, 2023

Conversation

AzukiPaste
Copy link
Contributor

Fix the duplicate directory name error that occurs when the destination directory already exists while moving folders.

@tiann
Copy link
Owner

tiann commented Jul 31, 2023

Under what circumstances would a user create a vendor/product file in the module root directory? If a user creates it unknowingly and the file gets overwritten, the issue would still exist.

@AzukiPaste
Copy link
Contributor Author

I have noticed the WARNING DO NOT MANUALLY CREATE OR MODIFY.
However, install_module creates vendor/product/system_ext files in MODPATH during installation if any user uses variable REMOVE or REPLACE.
Currently the lines of # Handle remove files are superior of handle_partition lines in installer.sh, so here comes the bug: modified files in MODPATH/system/system_ext which are supposed to overlay would be moved to MODPATH/system_ext/system_ext then the overlay path wrongs too.

@AzukiPaste
Copy link
Contributor Author

If files realpath is in /vendor or /product or /system_ext partitions, its okay when REMOVE="$(readlink -f "$file" | sed 's|^/vendor/|/system&|;s|^/product/|/system&|;s|^/system_ext/|/system&|')".

Maybe changing the using method of REMOVE is a proper way to fix the situation mentioned above.

Look forward for your reply.

@tiann
Copy link
Owner

tiann commented Aug 1, 2023

I think I understand what you mean by:

If the user wants to REMOVE /vendor/priv-app/A, and /system/vendor is a symlink to /vendor; if it writes:

REMOVE=/vendor/priv-app/A is normal, but if it uses

REMOVE=/system/vendor/priv-app/A will result in wrong path; is it so?

@AzukiPaste
Copy link
Contributor Author

AzukiPaste commented Aug 1, 2023

Sorry I did not clearly comment. Let me try describing more.

If the user wants to REMOVE /vendor/priv-app/A, and /system/vendor is a symlink to /vendor; and MODULE ZIP FILE contains /system/vendor/priv-app/B to REPLACE /vendor/priv-app/B;
if he writes:

REMOVE=/vendor/priv-app/A
- /vendor/priv-app/A will be REMOVEd normally;
- /vendor/priv-app/B will NOT be REPLACEd. $MODZIP/system/vendor/priv-app/B will be in /vendor/vendor/priv-app/B.
- At this case, $MODPATH/vendor created by REMOVE exists, then mv $MODPATHE/system/vendor $MODPATH/vendor will result in wrong path.

REMOVE=/system/vendor/priv-app/A
- /vendor/priv-app/A will be REMOVEd normally;
- /vendor/priv-app/B will be PEPLACEd normally.
- At this case, files moved from $MODPATH/system/vendor to $MODPATH/vendor without problem(existance of destination directory) and everything works well.

@tiann
Copy link
Owner

tiann commented Aug 1, 2023

Thank you, i understand it.

@tiann tiann merged commit 983ad2c into tiann:main Aug 1, 2023
6 checks passed
@tiann
Copy link
Owner

tiann commented Sep 9, 2023

I'll revert this since it causes other bugs:

  1. REPLACE=/system/product/app/A would fail, because there isn't any file in directory, only dir, so find "$1" -type f would find nothing.
  2. REMOVE=/system/product/app/A would fail, because find "$1" -type f would skip character devices.

tiann added a commit that referenced this pull request Sep 9, 2023
@tiann tiann mentioned this pull request Jan 8, 2024
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

Successfully merging this pull request may close these issues.

2 participants