ruborg 0.7.5 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 288150d1a678f2df71346d94b797019f31a52008de43663aa19cb9fd3584d5a6
4
- data.tar.gz: 460fe4bff0085989bc9a2d2ae4db7ae4591aff9a928ae9d320cd079d4d6a276d
3
+ metadata.gz: 8cc86659dca9c85fca163fd08ad8f23d4a0ca296cb32944274f6ae87e0086751
4
+ data.tar.gz: 2fb298807e3960026917f05a0552161c4d778cc7102ac62150b41710c8f0b1a7
5
5
  SHA512:
6
- metadata.gz: 34f36001b129d8e0bd005ba1e908361df50df198626fe98b5015afa6cbce2860b055086e87c6f81e4aebec101c1297832b525d78e1ce995d5582d40ee9065eaf
7
- data.tar.gz: b881f8bbd05e49893afb7213ab22d64d01117f3dedbdee6772b80720489d367b7a2bb6a1c33a9e63161f6673b3683198b33010a7c54dcf70e38e56461f7ec1ee
6
+ metadata.gz: 8443ac13e208645f5bce4126961c7c765b33f22038a2fcf92aedff110e3c3cc1def4db52c3c847c4aae13d3d8871c02dd00d67d71ec6d37698ad2084044954df
7
+ data.tar.gz: 33707f77cffb7e756fe0446786cd11807bf2f168b6b40ba40efc5ff4854017ec9871fe48127047f574d35e6fad376a32fcc5d348536b76079edaf14755dbc40e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.0] - 2025-10-09
11
+
12
+ ### Removed
13
+ - **chattr/lsattr Functionality**: Completely removed Linux immutable attribute handling
14
+ - The feature caused issues with network filesystems (CIFS/SMB, NFS) that don't support chattr
15
+ - Users with truly immutable files should remove the attribute manually before using `--remove-source`
16
+ - Simplifies code and eliminates filesystem compatibility issues
17
+ - `--remove-source` now relies on standard file permissions only
18
+
19
+ ### Changed
20
+ - File deletion now uses standard Ruby FileUtils methods without chattr checks
21
+ - Improved compatibility with all filesystem types (local, network, cloud)
22
+
23
+ ## [0.7.6] - 2025-10-09
24
+
25
+ ### Fixed
26
+ - **Filesystem Compatibility**: Gracefully handle filesystems that don't support chattr operations
27
+ - Network filesystems (NFS, CIFS/SMB) and non-Linux filesystems (NTFS, FAT, exFAT) often don't support Linux file attributes
28
+ - When chattr fails with "Operation not supported", log warning and continue with deletion
29
+ - Allows `--remove-source` to work on network shares and external drives
30
+ - Fixes error: "Cannot remove immutable file: ... Error: chattr: Operation not supported"
31
+
32
+ ### Technical Details
33
+ - Detects "Operation not supported" error from chattr command (lib/ruborg/backup.rb:394)
34
+ - Logs informative warning about filesystem limitations
35
+ - Continues with file deletion (no longer raises error)
36
+ - Test coverage: Added comprehensive test for unsupported filesystem scenario
37
+
10
38
  ## [0.7.5] - 2025-10-09
11
39
 
12
40
  ### Added
data/README.md CHANGED
@@ -398,25 +398,6 @@ Error: Cannot use --remove-source: 'allow_remove_source' must be true (boolean).
398
398
  Current value: "true" (String). Set 'allow_remove_source: true' in configuration.
399
399
  ```
400
400
 
401
- **📌 Immutable File Handling (Linux)**
402
-
403
- Ruborg automatically detects and removes Linux immutable attributes (`chattr +i`) when deleting files with `--remove-source`:
404
-
405
- - **Automatic Detection**: Checks files with `lsattr` before deletion
406
- - **Automatic Removal**: Removes immutable flag with `chattr -i` if present
407
- - **Platform-Aware**: Gracefully skips on non-Linux systems (macOS, BSD, etc.)
408
- - **Comprehensive**: Works for both single files and directories (recursive)
409
- - **Logged**: All immutable attribute operations are logged for audit trail
410
-
411
- **Root Privileges**: If your files have immutable attributes, you'll need root privileges to remove them. Configure sudoers for ruborg:
412
-
413
- ```bash
414
- # /etc/sudoers.d/ruborg
415
- michail ALL=(root) NOPASSWD: /usr/local/bin/ruborg
416
- ```
417
-
418
- This allows running ruborg with sudo for file deletion without password prompts.
419
-
420
401
  ### List Archives
421
402
 
422
403
  ```bash
data/SECURITY.md CHANGED
@@ -19,15 +19,7 @@ Ruborg implements several security measures to protect your backup operations:
19
19
  - Refuses to delete system directories even when targeted via symlinks
20
20
  - Uses `FileUtils.rm_rf` with `secure: true` option
21
21
 
22
- ### 4. Immutable File Handling (Linux)
23
- - **Automatic Detection**: Checks for Linux immutable attributes (`lsattr`) before file deletion
24
- - **Safe Removal**: Removes immutable flag (`chattr -i`) only when necessary for deletion
25
- - **Platform-Aware**: Feature only active on Linux systems with lsattr/chattr commands available
26
- - **Error Handling**: Raises informative errors if immutable flag cannot be removed
27
- - **Audit Trail**: All immutable attribute operations are logged for security auditing
28
- - **Root Required**: Removing immutable attributes requires root privileges (use sudo with appropriate sudoers configuration)
29
-
30
- ### 5. Safe YAML Loading
22
+ ### 4. Safe YAML Loading
31
23
  - Uses `YAML.safe_load_file` to prevent arbitrary code execution
32
24
  - Rejects YAML files containing Ruby objects or other dangerous constructs
33
25
  - Only permits basic data types and Symbol class
data/lib/ruborg/backup.rb CHANGED
@@ -361,58 +361,10 @@ module Ruborg
361
361
  raise BorgError, "Refusing to delete system path: #{real_path}"
362
362
  end
363
363
 
364
- # Check for immutable attribute and remove it if present
365
- remove_immutable_attribute(real_path)
366
-
367
364
  @logger&.info("Removing file: #{real_path}")
368
365
  FileUtils.rm(real_path)
369
366
  end
370
367
 
371
- def remove_immutable_attribute(file_path)
372
- # Check if lsattr command is available (Linux only)
373
- return unless system("which lsattr > /dev/null 2>&1")
374
-
375
- # Get file attributes
376
- require "open3"
377
- stdout, stderr, status = Open3.capture3("lsattr", file_path)
378
-
379
- unless status.success?
380
- @logger&.warn("Could not check attributes for #{file_path}: #{stderr.strip}")
381
- return
382
- end
383
-
384
- # Check if immutable flag is set (format: "----i--------e----- /path/to/file")
385
- # Extract the flags portion (everything before the file path)
386
- flags = stdout.split.first || ""
387
- return unless flags.include?("i")
388
-
389
- @logger&.info("Removing immutable attribute from: #{file_path}")
390
- _chattr_stdout, chattr_stderr, chattr_status = Open3.capture3("chattr", "-i", file_path)
391
-
392
- unless chattr_status.success?
393
- @logger&.error("Failed to remove immutable attribute from #{file_path}: #{chattr_stderr.strip}")
394
- raise BorgError, "Cannot remove immutable file: #{file_path}. Error: #{chattr_stderr.strip}"
395
- end
396
-
397
- @logger&.info("Successfully removed immutable attribute from: #{file_path}")
398
- end
399
-
400
- def remove_immutable_from_directory(dir_path)
401
- # Check if lsattr command is available (Linux only)
402
- return unless system("which lsattr > /dev/null 2>&1")
403
-
404
- require "find"
405
- require "open3"
406
-
407
- # Remove immutable from directory itself
408
- remove_immutable_attribute(dir_path)
409
-
410
- # Recursively remove immutable from all files in directory
411
- Find.find(dir_path) do |path|
412
- remove_immutable_attribute(path) if File.file?(path)
413
- end
414
- end
415
-
416
368
  def remove_source_files
417
369
  require "fileutils"
418
370
 
@@ -446,12 +398,8 @@ module Ruborg
446
398
  @logger&.info("Removing #{file_type}: #{real_path}")
447
399
 
448
400
  if File.directory?(real_path)
449
- # Remove immutable attributes from all files in directory
450
- remove_immutable_from_directory(real_path)
451
401
  FileUtils.rm_rf(real_path, secure: true)
452
402
  elsif File.file?(real_path)
453
- # Remove immutable attribute from single file
454
- remove_immutable_attribute(real_path)
455
403
  FileUtils.rm(real_path)
456
404
  end
457
405
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ruborg
4
- VERSION = "0.7.5"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruborg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michail Pantelelis