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

Use rm instead instead of custom function for purging #347

Merged
merged 11 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
=== rmw ChangeLog ===
2022-09-21

- When purging, '-ff' is no longer needed to confirm removal of
non-writable expired directories and files
* When purging, the 'rm' binary native to the user's
system will now be used.
+ When purging, if the user's native 'rm' has the '--one-file-system'
argument available, it will be automatically used when calling 'rm'.

2022-02-08

Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ OPTIONS
-f, --force
allow purging of expired files

rmw will refuse to purge directories if they contain non-writable
files or subdirectories. rmw will show a message that tells you
"permission denied; directory still contains files". To override,
you can re-run rmw using '-ffg'.

By default, force is not required to enable the purge feature. If
you would like to require it, add 'force_required' to your config
file.
Expand Down
4 changes: 0 additions & 4 deletions man/rmw.1
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ is unintentionally released with a bug.
\fB\-f\fR, \fB\-\-force\fR
allow purging of expired files
.IP
rmw will refuse to purge directories if they contain non-writable files
or subdirectories. rmw will show a message that tells you "permission
denied; directory still contains files". To override, you can re-run
rmw using '-ffg'.

By default, force is not required to enable the purge feature. If you would
like to require it, add 'force_required' to your config file.
Expand Down
9 changes: 9 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ conf.set_quoted('PACKAGE_STRING', meson.project_name())
conf.set_quoted('PACKAGE_URL', 'https://remove-to-waste.info/')
conf.set_quoted('PACKAGE_BUGREPORT', 'https://github.com/theimpossibleastronaut/rmw/issues')

foo_file = 'foo_rmw.txt'
configure_file(output: foo_file, configuration: configuration_data())
rm_cmd = find_program('rm', required: true)
conf.set_quoted('RM_FULL_PATH', rm_cmd.full_path())
r = run_command(rm_cmd, '--one-file-system', join_paths(meson.project_build_root(), foo_file), check: false)
if r.returncode() == 0
conf.set('RM_HAS_ONE_FILE_SYSTEM_ARG', 1)
endif

check_headers = [
['ncursesw/menu.h', 'HAVE_NCURSESW_MENU_H'],
['ncurses/menu.h', 'HAVE_NCURSES_MENU_H'],
Expand Down
2 changes: 2 additions & 0 deletions packaging/release-checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Make the AppImage
meson configure -Dbuildtype=release -Dstrip=true -Dprefix=/usr
DESTDIR=AppDir ninja install

cp /usr/bin/rm AppDir/usr/bin

(path to where the linuxdeploy appimage was extracted)/squashfs-root/AppRun -d /rmw/packaging/rmw.desktop \
--icon-file=/rmw/packaging/rmw_icon_32x32.png \
--icon-filename=rmw --executable AppDir/usr/bin/rmw --appdir AppDir --output appimage
Expand Down
3 changes: 1 addition & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,7 @@ Please check your configuration file and permissions\
msg_warn_restore(restore_errors += restore(argv[file_arg],
&st_time_var,
&cli_user_options,
st_config_data.
st_waste_folder_props_head));
st_config_data.st_waste_folder_props_head));

dispose_waste(st_config_data.st_waste_folder_props_head);

Expand Down
3 changes: 2 additions & 1 deletion src/messages_rmw.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ msg_err_remove(const char *file, const char *func)
print_msg_error();
/* TRANSLATORS: "removing" refers to a file or folder */
fprintf(stderr, _("while removing %s\n"), file);
perror(func);
if (errno)
perror(func);
}


Expand Down
Loading