debugging some things

This commit is contained in:
~d6 2024-09-25 23:13:04 -04:00
parent 03bb613e4e
commit 4f0a9dfdbe
1 changed files with 40 additions and 2 deletions

42
tar.tal
View File

@ -5,12 +5,16 @@
( see https://en.wikipedia.org/wiki/Tar_(computing)#UStar_format ) ( see https://en.wikipedia.org/wiki/Tar_(computing)#UStar_format )
( ) ( )
( TODO: ) ( TODO: )
( - check for "ustar" header )
( - handle filename-prefix )
( - handle 'L' entries )
( - support creating archives ) ( - support creating archives )
( - arg validation should depend on mode ) ( - arg validation should depend on mode )
( - validate checksums ) ( - validate checksums )
( - better error messages on unsupported files, e.g. symlinks ) ( - better error messages on unsupported files, e.g. symlinks )
( - better usage message ) ( - better usage message )
( - support using "-" for stdin/stdout? ) ( - support using "-" for stdin/stdout? )
( - option to ignore symlinks? )
( File1 is used to read/write the tar file ) ( File1 is used to read/write the tar file )
( File2 is used to read/write files and directories ) ( File2 is used to read/write files and directories )
@ -82,7 +86,8 @@
DUP LIT "0 EQU ?list-file-v ( type^ ) DUP LIT "0 EQU ?list-file-v ( type^ )
DUP LIT "5 EQU ?list-dir-v ( type^ ) DUP LIT "5 EQU ?list-dir-v ( type^ )
DUP LIT "7 EQU ?list-file-v ( type^ ) DUP LIT "7 EQU ?list-file-v ( type^ )
!fail-unsupported ( ) !list-weird-v
( !fail-unsupported ) ( )
( non-verbose file entry listing ) ( non-verbose file entry listing )
@list-file ( 00^ -> ) @list-file ( 00^ -> )
@ -98,6 +103,20 @@
;header/filename #0064 lprint #0a18 DEO ;header/filename #0064 lprint #0a18 DEO
!list-entries !list-entries
( verbose file entry listing )
@list-weird-v ( type^ -> )
( POP )
( LIT "f ) #18 DEO #2018 DEO
;header/size load-octal11 dump-longer #2018 DEO
;header/filename #0064 lprint #0a18 DEO
;header/size load-octal11 round-up-to-512
( dump-header )
;header/size .File2/name DEO2
;header/size load-octal11 STH2k write
STH2r remainder-512 skip-lo !list-entries
( verbose file entry listing ) ( verbose file entry listing )
@list-file-v ( type^ -> ) @list-file-v ( type^ -> )
POP POP
@ -139,7 +158,7 @@
LDAk LIT "/ NEQ JMP INC2 JMP2r LDAk LIT "/ NEQ JMP INC2 JMP2r
@remainder-512 ( n* -> extra* ) @remainder-512 ( n* -> extra* )
#01ff AND2 #0200 SWP2 SUB2 ORAk ?{ POP2 #0000 } JMP2r #01ff AND2 #0200 DUP2 ROT2 SUB2 NEQ2k ?{ POP2 #0000 } NIP2 JMP2r
@expand-file ( type^ -> ) @expand-file ( type^ -> )
POP POP
@ -192,6 +211,9 @@
;skip-buf ;write-lo/writer STA2 ;skip-buf ;write-lo/writer STA2
write-lo write-hi ?write-4g JMP2r write-lo write-hi ?write-4g JMP2r
@skip-lo ( lo* -> )
;skip-buf ;write-lo/writer STA2 !write-lo
( skips up to 32768 bytes of; limited by the size of buf ) ( skips up to 32768 bytes of; limited by the size of buf )
@skip-buf ( n* -> ) @skip-buf ( n* -> )
ORAk ?{ POP2 JMP2r } ORAk ?{ POP2 JMP2r }
@ -321,6 +343,8 @@
&loop2 GTH2k ?{ NIP2 LDA #18 DEO #2018 DEO JMP2r } &loop2 GTH2k ?{ NIP2 LDA #18 DEO #2018 DEO JMP2r }
LDAk #18 DEO INC2 !&loop2 LDAk #18 DEO INC2 !&loop2
@dump-body1 ( -> )
@dump-header ( -> ) @dump-header ( -> )
LIT2 "- 18 DEOk DEOk DEOk DEOk DEO #0a18 DEO LIT2 "- 18 DEOk DEOk DEOk DEOk DEO #0a18 DEO
;header/filename #0064 dump-mem ;header/filename #0064 dump-mem
@ -378,6 +402,17 @@
( '7' contiguous file -- treat as normal file ) ( '7' contiguous file -- treat as normal file )
( 'g' global extended header with metadata; POSIX.1-2001 ) ( 'g' global extended header with metadata; POSIX.1-2001 )
( 'x' extended header with metadata for next file; POSIX.1-2001 ) ( 'x' extended header with metadata for next file; POSIX.1-2001 )
( 'A' solaris ACL )
( 'D' gnu dump dir )
( 'E' solaris extended attrs )
( 'I' inode metadata )
( 'K' this entry's data is the long link location of next file, null-terminated? )
( 'L' this entry's data is the long filename of next file, null-terminated )
( 'M' continuation file )
( 'N' old gnu for long names )
( 'S' sparse files )
( 'V' tape/volume header )
( 'X' extended attrs, sun )
( /linkname -- for hardlinks, the file containing the linked data ) ( /linkname -- for hardlinks, the file containing the linked data )
( uheader -- ustar header, found in v7 padding bytes ) ( uheader -- ustar header, found in v7 padding bytes )
( /ustar -- ustar indiciator, should be "ustar " ) ( /ustar -- ustar indiciator, should be "ustar " )
@ -412,5 +447,8 @@
&pad $c ( 0x1f4: padding, 12 bytes ) &pad $c ( 0x1f4: padding, 12 bytes )
&end ( 0x200: end of header ) &end ( 0x200: end of header )
( buffer for up to 4096 characters of long names/paths )
|7000 @long-buf $1000
( buffer for reading up to 32k bytes of data at a time ) ( buffer for reading up to 32k bytes of data at a time )
|8000 @buffer $8000 |8000 @buffer $8000