mirror of
https://github.com/JotaRandom/hfsutils.git
synced 2026-01-26 06:16:44 +00:00
## Specification Conformance Fixes ### Alternate Header Location (Critical Bug Fix) - Fixed alternate MDB/VH location for both HFS and HFS+ - Changed from (total_sectors - 1) * sector_size to device_size - 1024 - Conforms to Apple TN1150: '1024 bytes before the end of the volume' - Files: src/mkfs/mkfs_hfs_format.c ### HFS+ Volume Header Field Alignment - Added missing rsrcClumpSize field (offset +56, 4 bytes) - Added missing dataClumpSize field (offset +60, 4 bytes) - Fixed nextCatalogID placement (now correctly at offset +64) - Set nextCatalogID initial value to 16 (kHFSFirstUserCatalogNodeID) - Files: src/mkfs/mkfs_hfs_format.c ### HFS+ Volume Attributes - Set kHFSVolumeUnmountedBit (0x0100) in attributes field - Changed from 0x00000000 to 0x00000100 per TN1150 spec - Files: src/mkfs/mkfs_hfs_format.c ## Documentation ### New Technical Documentation (./doc/) - TN1150_HFS_PLUS_VOLUME_FORMAT.md: Apple official HFS+ spec - HFS_CLASSIC_SPECIFICATION.md: Complete HFS Classic spec - WIKIPEDIA_HFS_PLUS.md: Wikipedia HFS+ reference - HFS_IMPLEMENTATION_NOTES.md: Practical implementation guide - DEVELOPMENT_HISTORY.md: Project evolution and lessons learned - README.md: Documentation index with quick reference Total: 6 technical documents, 65.9 KB offline reference ## Project Reorganization ### Consolidated Documentation - Removed 9 scattered summary .md files from root - Consolidated into doc/DEVELOPMENT_HISTORY.md - Files removed: BUILD_SYSTEM_SUMMARY.md, DEPENDENCY_RESOLUTION_SUMMARY.md, EMBEDDED_REORGANIZATION_SUMMARY.md, HFS_PLUS_IMPLEMENTATION_SUMMARY.md, TASK_3.4_COMPLETION_SUMMARY.md, MKFS_TEST_RESULTS.md, CORRECCION.md, ENTREGABLES.md, RESUMEN_FINAL.md ### Organized Test Scripts - Moved 7 test scripts from root to test/ - Scripts: test_fsck_enhanced.sh, test_hcopy_manual*.sh, test_hfs_integrity.sh, test_hfs_spec_validation.sh, test_recursive_integrity.sh, test_spec_conformance.sh ### Updated .gitignore - Added temporary log files (build_output.log, test_output.txt, etc.) - Added generated configuration files (Makefiles, config.h, os.c) - Added IDE directories (.vs/) - Added consolidated documentation patterns (*_SUMMARY.md) ## Updated Files - README.md: Links to new documentation, updated limitations - TODO: Current status (November 2025), recent achievements - PROJECT_STRUCTURE.md: Updated directory structure documentation - test/README.md: Updated test organization ## Impact - Specification-compliant HFS/HFS+ volume creation - Clean, navigable project structure (24 root files vs ~40) - Comprehensive offline technical documentation - All tests organized in test/ directory Resolves: Specification conformance issues Related: Apple TN1150, HFS/HFS+ standards compliance
HFS Utilities Test Suite
Comprehensive testing framework for Apple Silicon HFS utilities.
Quick Start
# Generate test data (HFS images and sample files)
./generate_test_data.sh
# Run all tests
./run_tests.sh
# Run specific test categories
./run_tests.sh basic # Basic functionality tests
./run_tests.sh integration # Integration workflow tests
./run_tests.sh errors # Error handling tests
# Run feature-specific tests
./test_hcopy_directory.sh # Test hcopy recursive directory copying
# Simple integration demonstration
./simple_integration_test.sh
Test Structure
1. Test Data Generator (generate_test_data.sh)
Creates various HFS and HFS+ images and sample files for testing:
- Small images (1.44MB): Basic testing with simple file structure (HFS and HFS+)
- Medium images (10MB): More complex directory hierarchies (HFS and HFS+)
- Large images (50MB): Stress testing with many files (HFS and HFS+)
- Empty images: Testing empty volume operations (HFS and HFS+)
- Corrupted image: Error handling tests
2. Main Test Runner (run_tests.sh)
Comprehensive test harness with multiple test categories:
Basic Functionality Tests
- Utility existence checks
- Help/version output
- Mount/unmount operations
- Directory listing and navigation
- File operations (copy, delete, rename)
- Directory operations (create, remove)
- Volume information display
Integration Workflow Tests
- Backup/Restore: Complete backup and restoration workflow
- Archive Creation: Organizing files by type
- Volume Migration: Moving data between volumes
- File Management: Complex directory structures
- Data Recovery: Simulated recovery scenarios
Error Handling Tests
- Operations without mounted volumes
- Non-existent file/directory access
- Invalid operations (e.g., deleting directories with hdel)
- Edge cases (special characters, empty files, deep paths)
HFS+ Specific Tests
- HFS+ volume formatting with hformat -t hfs+ and mkfs.hfs+
- Filesystem type detection (HFS vs HFS+)
- Program name detection (mkfs.hfs, mkfs.hfs+, fsck.hfs+)
- HFS+ volume information and validation
- Mixed HFS/HFS+ operations and compatibility
3. Simple Integration Test (simple_integration_test.sh)
A straightforward demonstration that:
- Creates and formats an HFS volume
- Creates directory structure
- Copies files to/from the volume
- Tests navigation and file operations
- Verifies all utilities work together
4. Feature-Specific Tests (test_hcopy_directory.sh)
Comprehensive test suite for the hcopy recursive directory copying feature:
- Tests recursive copying of directory structures with
-rflag - Validates nested directories and file preservation
- Tests edge cases (empty directories, special characters)
- Includes real-world recovery scenarios
- Can be run independently or integrated into main test suite
Test Options
./run_tests.sh [OPTIONS] [TEST_PATTERN]
Options:
-v, --verbose Enable verbose output
-q, --quick Skip stress tests
-k, --keep Keep test files for inspection
-h, --help Show help message
Test patterns:
all Run all tests (default)
basic Basic functionality only
integration Integration workflows only
errors Error handling only
hfsplus HFS+ specific tests only
Test Results
The test suite validates:
- ✅ All utilities compile and run on Apple Silicon
- ✅ Basic HFS operations (mount, copy, delete, rename)
- ✅ HFS+ volume creation and formatting
- ✅ Filesystem type detection and program name recognition
- ✅ Directory navigation and management
- ✅ Inter-utility workflows and data pipelines
- ✅ Error handling and edge cases
- ✅ Volume information and management
- ✅ Mixed HFS/HFS+ environment compatibility
- ✅ Recursive directory copying with hcopy (when implemented)
Known Issues
- MacBinary Detection: Binary files may trigger MacBinary format detection
- Path Navigation:
hcdchanges affect relative paths in subsequent commands - Test Isolation: Some tests may leave mounted volumes on failure
Future Enhancements
- Performance benchmarking
- Stress testing with large file counts
- Concurrent operation testing
- Extended attribute preservation tests
- Cross-volume operation tests
Contributing
When adding new tests:
- Add test data generation to
generate_test_data.shif needed - Implement test function in
run_tests.shfor main suite integration - Update appropriate test category in the case statement
- For feature-specific tests, create separate
test_feature_name.shfiles - Document any new test patterns in this README
Requirements
- Bash 3.2+
- Standard Unix utilities (dd, grep, etc.)
- Compiled HFS utilities in parent directory