File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,12 +22,16 @@ jobs:
2222 for i in {1..100};do
2323 echo "hello world" >> test/test.txt
2424 done
25- dd if=/dev/zero of=test.ext4 count=1024 bs=1024
26- mkfs.ext4 test.ext4 -d test
25+ dd if=/dev/zero of=test.ext4.tmp count=1024 bs=1024
26+ mkfs.ext4 test.ext4.tmp -d test
27+ echo -n F > test.ext4
28+ cat test.ext4.tmp >> test.ext4
2729 - uses : actions/upload-artifact@v4
2830 with :
2931 name : test.ext4
30- path : test.ext4
32+ path : |
33+ test.ext4
34+ test.ext4.tmp
3135 if-no-files-found : error
3236 test :
3337 name : Test on ${{ matrix.os }} python ${{ matrix.python }}
Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ def field_type(cls, name):
4141 return None
4242
4343 def read_from_volume (self ):
44- self .volume .stream . seek (self .offset )
45- data = self .volume .stream . read (sizeof (self ))
44+ self .volume .seek (self .offset )
45+ data = self .volume .read (sizeof (self ))
4646 memmove (addressof (self ), data , sizeof (self ))
4747
4848 @property
Original file line number Diff line number Diff line change 11[project ]
22name = " ext4"
3- version = " 1.1.0 "
3+ version = " 1.1.1 "
44authors = [
55 { name =" Eeems" , email =" eeems@eeems.email" },
66]
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import os
34import sys
45import ext4
56
@@ -43,9 +44,26 @@ def _assert(source: str):
4344test_path_tuple ("/test/test" , (b"test" , b"test" ))
4445test_path_tuple (b"/test/test" , (b"test" , b"test" ))
4546
47+ offset = os .path .getsize ("test.ext4" ) - os .path .getsize ("test.ext4.tmp" )
48+ _assert ("offset > 0" )
4649with open ("test.ext4" , "rb" ) as f :
50+ try :
51+ print ("check MagicError: " , end = "" )
52+ _ = ext4 .Volume (f , offset = 0 )
53+ FAILED = True
54+ print ("fail" )
55+ print (" MagicError not raised" )
56+ except ext4 .struct .MagicError :
57+ print ("pass" )
58+
59+ except Exception as e :
60+ FAILED = True
61+ print ("fail" )
62+ print (" " , end = "" )
63+ print (e )
64+
4765 # Extract specific file
48- volume = ext4 .Volume (f , offset = 0 )
66+ volume = ext4 .Volume (f , offset = offset )
4967 inode = cast (ext4 .File , volume .inode_at ("/test.txt" ))
5068 _assert ("isinstance(inode, ext4.File)" )
5169 b = inode .open ()
Original file line number Diff line number Diff line change @@ -20,8 +20,10 @@ if ! [ -f test.ext4 ];then
2020 for i in {1..100}; do
2121 echo " hello world" >> " $tmp_dir " /test.txt
2222 done
23- dd if=/dev/zero of=test.ext4 count=1024 bs=1024
24- trap " rm test.ext4" EXIT
25- mkfs.ext4 test.ext4 -d " $tmp_dir "
23+ trap " rm -f test.ext4{,.tmp}" EXIT
24+ dd if=/dev/zero of=test.ext4.tmp count=1024 bs=1024
25+ mkfs.ext4 test.ext4.tmp -d " $tmp_dir "
26+ echo -n F > test.ext4
27+ cat test.ext4.tmp >> test.ext4
2628fi
2729python test.py
You can’t perform that action at this time.
0 commit comments