Skip to content

fix: replace bad substitution \${} with \${NOCOLOR} in size_calculation#2

Open
roemer2201 wants to merge 22 commits into
mainfrom
claude/remote-netcat-uncompressed
Open

fix: replace bad substitution \${} with \${NOCOLOR} in size_calculation#2
roemer2201 wants to merge 22 commits into
mainfrom
claude/remote-netcat-uncompressed

Conversation

@roemer2201

Copy link
Copy Markdown
Owner

Line 377 contained ${} which causes a bash "bad substitution" error,
silently swallowing the hint message when input size is not evenly
divisible. Also added the missing closing parenthesis.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum

claude added 22 commits May 22, 2026 11:50
Line 377 contained \${} which causes a bash "bad substitution" error,
silently swallowing the hint message when input size is not evenly
divisible. Also added the missing closing parenthesis.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
…atches

grep "FILE_NAME" matched both FILE_NAME= and INPUT_FILE_NAME=,
grep "COMPRESSION" matched both COMPRESSION= and COMPRESSION_LEVEL=.
Added ^ anchor so each pattern only matches its intended metadata key.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Data transfer uses nc over TCP, so UDP monitoring (-u flag) is
irrelevant. Removed -u from the two process-running checks to match
check_remote_port_availability which already used -tln.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
grep -q \":PORT\" matched partial ports (e.g. :100 matched :10000).
Changed to grep -qE with [^0-9] suffix so only the exact port number
matches.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Unquoted \${INPUT} and \${OUTPUT} in file, stat, and blockdev calls
are subject to word splitting. Also fixed two \${INPUT_SIZE=} typos
to \${INPUT_SIZE} in the same block.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Without -e the ANSI escape codes were printed as literal text instead
of being interpreted as colors.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
fallocate pre-allocates the output file once before writing starts.
Running it once per job caused redundant syscalls and potential
conflicts when jobs ran in parallel.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
RANDOM is 0-32767, so RANDOM % 55001 is identical to RANDOM.
The comments claimed a range of 10000-55000 which was never reachable.
Simplified to REMOTE_PORT=$(( RANDOM + 10000 )) with accurate comment.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Covers prerequisites, local clone/backup/restore (compressed and
uncompressed), check scenarios, remote netcat/SSH modes, and
additional options (-s, -j, -b, -d, -f).

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Covers file structure, coding conventions, metadata format, known
limitations, and branch strategy.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Sets shell=bash and disables SC2034 (unused color variables) and
SC2207 (array splitting) which are intentional patterns in this
codebase.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Covers parallelization concept, dynamic pipe construction, metadata
format, SSH multiplexing, port selection, and function overview.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Provides 'make lint' to run ShellCheck on all scripts and
'make install-deps' for installing ShellCheck on Debian/Ubuntu.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Lists all 13 fixes with commit hashes and short explanation of each
bug and its impact.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Adds check_cloned_image() which compares source and destination
segment by segment via parallel SHA256 hashing, without requiring
backup metadata or .sha256 files. New -j and -B options set job count
and block size (defaults 4 / 1048576). Fills the previously empty
SOURCE+DESTINATION branch and validates divisibility. Marks the local
clone-check cells as done in README.

https://claude.ai/code/session_015DcyEK7Zc8YCewMCV9Ayum
Implements the missing remote_backup_commands function and wires the
backup mode to transfer split parts to a remote host over netcat,
mirroring the existing remote clone path. Metadata and free-space
handling are made remote-aware via an append_metadata helper.

https://claude.ai/code/session_01Snu46hRFQBRdJTC9DDGZ6r
Replaces the previously unimplemented section 4.6 with test commands for
remote uncompressed backup (block device and file), including a fake-ssh
stub recipe for validating the remote code path without an SSH server.

https://claude.ai/code/session_01Snu46hRFQBRdJTC9DDGZ6r
Adds SSH/netcat remote support to the restore script: the backup parts
live on the remote host and are streamed back to a local target device
via netcat (remote sends, local receives). Metadata is read from the
remote host. Uncompressed only; compressed remote backups are rejected.

Also adds conv=notrunc to the reassembly dd so parallel writers no
longer truncate each other when restoring to a regular file.

https://claude.ai/code/session_01Snu46hRFQBRdJTC9DDGZ6r
Adds SSH support so source/backup/destination checks work when the
backup parts or cloned target live on a remote host. Per-segment SHA256
hashes are computed locally and via SSH on the remote side and compared;
no netcat data transfer is needed. Covers all three comparisons:
- backup check  (source local  <-> backup remote .part)
- restore check (backup remote .part <-> destination local)
- clone check   (source local  <-> destination remote)

Metadata is read from the remote host; compressed remote backups are
rejected. Local checks (incl. the .sha256-based paths) are unchanged.

https://claude.ai/code/session_01Snu46hRFQBRdJTC9DDGZ6r
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