Commit Graph

3491 Commits

Author SHA1 Message Date
mgutt
8c0ff09401 Improve code readability: Reorder progress parsing logic and fix comment (ETA vs elapsed time) 2025-10-26 14:00:57 +01:00
mgutt
da0bfcafcc Fix grep regex: Remove -C1 context flag to prevent progress line in file line output 2025-10-26 13:56:46 +01:00
mgutt
f693c4966b Add comment explaining bash requirement for process substitution
Document that exec() uses /bin/sh which is symlinked to bash on
Unraid, making process substitution syntax >(...) available for
rsync commands.
2025-10-26 13:06:59 +01:00
mgutt
63328e944a Add explanatory comments and fix progress parsing
- Add comment explaining grep -v usage for filename extraction
- Document delete_empty_dirs state handling for both rsync methods
- Add trim() to progress line parsing to fix array indexing issue
  caused by leading whitespace in rsync output
2025-10-26 12:48:32 +01:00
mgutt
8103cbad4d Fix rsync output handling with process substitution
Use process substitution with stdbuf to capture rsync progress output
line-by-line in real-time. The '> >(stdbuf -o0 tr '\r' '\n' >status)'
pattern ensures unbuffered conversion of carriage returns to newlines,
allowing parse_rsync_progress() to read the latest updates via tac.
2025-10-26 12:31:19 +01:00
mgutt
38c6d843f0 Test stdbuf -o0 for unbuffered rsync output
- Add stdbuf -o0 to enable real-time progress updates in status file
- Capture rsync PID using subshell: { echo $!; tr ... }

Testing if this resolves buffering and PID tracking issues.
2025-10-26 03:23:35 +01:00
mgutt
58ec118854 Optimize file_manager buffering and regex patterns
- Add stdbuf -oL to rsync commands for immediate line-buffered output
  Fixes choppy/delayed progress updates in status file during transfers

- Switch from grep -P to -E with [0-9]+ patterns for POSIX compatibility
  Eliminates 'stray \ before d' warnings and improves portability
  More explicit and readable than \d+ shortcuts

- Update comments about rsync progress format differences:
  Running transfers show ETA, completed files show actual transfer time
2025-10-26 02:13:45 +01:00
mgutt
a33f8c44d3 Fix file_manager rsync issues: status parsing and directory permissions
1. Fixed status parsing bug where 'Completed: 118.88G, Speed: 2%, ETA: 58.91MB/s'
   showed wrong value assignments due to tr -s '[:space:]' compressing newlines.
   - Changed to tr -s ' \t' to preserve newlines
   - Optimized with shell-based tac/grep approach for better performance
   - Handles large rsync status files with thousands of progress lines efficiently

2. Added --no-inc-recursive flag to fix rsync creating directories with 0700 root:root
   permissions during copy-delete operations, causing SMB access issues.
   - Disables incremental recursion to avoid generator.c:1430 do_mkdir(...& 0700)
   - Should preserve 1:1 source permissions and improve progress calculation
   - NOTE: This is experimental and needs testing on dev server

Both fixes target the copy-delete operation (move files) that was most problematic.
2025-10-26 01:55:15 +02:00
mgutt
f105f35369 Enable parent-to-subdirectory check for rsync-rename moves
Prevents moving a directory into its own subdirectory, which would cause
rsync --backup-dir to create nested structures and fail to delete source.

Example prevented: /mnt/disk1/parent → /mnt/disk1/parent/subfolder

The check uses trailing slashes to ensure exact directory boundary matching
and prevent false positives (e.g., /parent vs /parent2).
2025-10-25 15:58:13 +02:00
mgutt
ef0be9c2b7 Rename $move to $delete_empty_dirs and add commented parent-to-subfolder check
- Renamed $move variable to $delete_empty_dirs for clearer intent
- Variable now only set to true for rsync copy-delete (not for rsync-rename)
- rsync-rename doesn't need cleanup since source is atomically moved
- Added commented code to prevent moving directory into its own subdirectory
2025-10-25 15:50:53 +02:00
mgutt
031b4bae9a Fix JSON array index bug in parse_rsync_progress()
Initialize text array as indexed array to prevent associative array
when only progress line is parsed. Ensures text[0] is always set,
avoiding JSON output like {"1":"..."} in WebGUI.
2025-10-25 13:52:41 +02:00
mgutt
be210fc701 Add minimum width guard to mb_strimhalf()
Prevent negative or zero values in $half calculation when $width < 8.
For small widths, simply truncate text without middle ellipsis.
2025-10-25 02:41:01 +02:00
mgutt
37e59b68e5 Fix file_manager bugs and migrate to JSON status format
Multiple improvements to file_manager reliability and status handling:

1. Fix rsync output parsing bug
   - rsync returns filename and progress lines in unpredictable order
   - Old JS parsing: text[1].split() assumed fixed line order
   - New approach: Simplified shell parsing (tail + tr) in PHP
   - parse_rsync_progress() helper function for consistent handling

2. Migrate status updates to JSON format
   - Structure: {action: int, text: [file_text, progress_text?]}
   - PHP: mb_strimhalf() for UTF-8-safe middle truncation
   - PHP: htmlspecialchars() escaping, JS adds icons client-side
   - Minimizes WebSocket overhead (no HTML in payload)
   - Universal handler in BrowseButton.page (6 lines)

3. Fix stale status messages (Nchan caching issue)
   - rc.nginx: nchan_message_timeout 30s for /pub/filemanager
   - Status expires automatically after 30s
   - Prevents displaying outdated progress status in footer

4. Remove obsolete move operation variants (case 5/10)
   - file_manager: Remove case 5/10 comments (mv-based move)
   - Browse.page: Remove action++ logic from doAction/doActions
   - BrowseButton.page: Remove case 5/10 from dfm_makeDialog()
   - All moves now use case 4/9 with automatic rsync-rename optimization
2025-10-25 02:27:00 +02:00
mgutt
69a21de7a4 file_manager: persist move state and handle restarts
- Initialize  outside the main loop to ensure correct state handling for move/cleanup phases
- If file_manager restarts and PID is loaded from file and move operation is still active, enable  to cleanup empty directories afterwards
- Clarify comment for INI job parameters
2025-10-24 13:26:10 +02:00
mgutt
77579fd0a5 Merge branch 'unraid:master' into optimize-file-manager-move 2025-10-24 12:27:59 +02:00
mgutt
6511029172 file_manager: use separate PID file instead of INI serialization
Replace complex INI serialization with simple separate .pid file:
- Avoids escaping issues (semicolons, hashes, newlines, etc.)
- No risk of INI file corruption
- Consistent with existing pattern (.active, .status, .error, .pid)
- Simpler code with fewer error sources
- Atomic writes (single number to file)
2025-10-24 04:21:46 +02:00
mgutt
fbcc3684c6 file_manager: remove redundant PID validation and persist PID to survive restarts 2025-10-24 04:06:01 +02:00
Squidly271
be16426033 Merge branch 'master' into patch-11 2025-10-22 17:19:09 -04:00
Squidly271
72e5bd4da7 Fix: wait time cutoff 2025-10-22 17:18:48 -04:00
tom mortensen
2fce67e2ad Merge pull request #2436 from SimonFair/Bug-Language-issue-for-bootvga-value-
Fix: bootvga  check.
2025-10-22 14:11:41 -07:00
tom mortensen
93ab3b1916 Merge pull request #2435 from Squidly271/patch-14
Fix: Unable to see radio boxes in tables on black
2025-10-22 14:11:17 -07:00
SimonFair
171c6f68a6 Fix bootvga check. 2025-10-22 21:16:43 +01:00
Squidly271
42f4e273eb Fix: Unable to see radio boxes in tables on black 2025-10-22 14:01:55 -04:00
Squidly271
55c3c7031a Fix: CPU pinning crashing if 3rd party container present 2025-10-22 13:28:18 -04:00
Squidly271
8227702a8f Fix: Font style when starting up containers 2025-10-22 13:08:33 -04:00
Squidly271
57a8d9f475 Capitalize title of sections and improve spacing 2025-10-21 18:01:29 -04:00
mgutt
2568736259 Escape rsync filter meta-characters and handle symlinked directories properly 2025-10-19 20:22:29 +02:00
mgutt
d37af270e5 Use device IDs instead of mount points for more robust filesystem comparison 2025-10-19 20:12:28 +02:00
mgutt
42d6622dea Add directory check for rsync rename optimization and suppress stderr from stat commands 2025-10-19 20:02:14 +02:00
mgutt
0b70940e15 Optimize file manager move operations on same filesystem 2025-10-19 19:04:36 +02:00
Tom Mortensen
a116309fdb Fix: SelfTest: remove text stating to disable spind down delay to run an extended self-test 2025-10-16 14:55:26 -07:00
tom mortensen
5dbe538f0e Merge pull request #2426 from Squidly271/patch-8
Fix: FF disabled menu item color
2025-10-16 13:26:14 -07:00
tom mortensen
c7324fd535 Merge pull request #2425 from SimonFair/Change-W11-VM-Defaults
Fix: Update VM page to show memory in GB if > 1024MB
2025-10-16 13:25:30 -07:00
Squidly271
66528c26a5 Sidebar 2025-10-16 09:46:33 -04:00
Squidly271
1940f8b363 Fix: FF disabled menu item color 2025-10-16 09:40:54 -04:00
SimonFair
52d55a2ebb Fix rounding.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-10-16 10:30:18 +01:00
SimonFair
5e4d04deae Fix: Update VM page to show memory in GB if > 1024MB 2025-10-16 10:23:18 +01:00
tom mortensen
ce4653aafb Merge pull request #2424 from SimonFair/Change-W11-VM-Defaults
Fix: set cd bus to sata for Win 11
2025-10-15 14:47:55 -07:00
tom mortensen
1ede0dd23c Merge pull request #2331 from bobbintb/vm-memory-slider
VM edit make RAM values human readable
2025-10-15 14:46:43 -07:00
SimonFair
0420111f92 Revert mk_options change. 2025-10-15 17:04:19 +01:00
SimonFair
d684cdd3de Merge remote-tracking branch 'upstream/master' into Change-W11-VM-Defaults 2025-10-15 16:28:45 +01:00
SimonFair
ca917c94cb remove code no longer required. 2025-10-15 16:25:43 +01:00
SimonFair
7d9f6e4a38 Fix: set cd bus to sata for Win 11 2025-10-15 12:54:35 +01:00
tom mortensen
1d24a6e6d7 Merge pull request #2423 from Squidly271/schedulehourly
Fix Display issue if schedule set to hourly
2025-10-14 21:12:53 -07:00
tom mortensen
f22fd5ba7a Merge pull request #2422 from Squidly271/7.3-pluginlogging
7.3 Adjust logging of inline FILE execution
2025-10-14 21:11:29 -07:00
tom mortensen
e31fda9099 Merge pull request #2421 from Squidly271/POC/safeeval
Refactor: Protect GUI from fatal PHP errors
2025-10-14 21:10:11 -07:00
tom mortensen
9e70f88bbb Merge pull request #2420 from Squidly271/Fix/VMSnapshot
Fix: Create snapshot display aberrations
2025-10-14 21:06:39 -07:00
tom mortensen
980cbf8e26 Merge pull request #2419 from SimonFair/Change-W11-VM-Defaults
Fix: Change Windows11 defaults
2025-10-14 21:05:53 -07:00
tom mortensen
d48d93823c Merge pull request #2418 from Squidly271/Feat/FocusFunc
Feat: Support Focus on page tabs
2025-10-14 21:05:02 -07:00
tom mortensen
75da9e0cdf Merge pull request #2416 from Squidly271/Chore/RemoveExtremeFontSizes
Chore: Only support small / normal / large font sizes
2025-10-14 17:33:31 -07:00