@@ -641,12 +641,18 @@ export async function prepareBundledAiRuntimePackage(
641641 ( ( tarballPath : string , destination : string ) =>
642642 // Source-ref validation runs this trusted harness outside the candidate's dependency tree.
643643 // Keep extraction on the system tar contract so only the candidate checkout needs install.
644- run ( "tar" , [ "-xzf" , tarballPath , "-C" , destination , "--strip-components=1" ] , destination , {
645- timeoutMs : resolveTimeoutMs (
646- "OPENCLAW_DOCKER_PACKAGE_PACK_TIMEOUT_MS" ,
647- DEFAULT_PACKAGE_PACK_TIMEOUT_MS ,
648- ) ,
649- } ) ) ;
644+ // Use an archive basename so GNU tar cannot treat a Windows drive as a remote host.
645+ run (
646+ "tar" ,
647+ [ "-xzf" , path . basename ( tarballPath ) , "-C" , destination , "--strip-components=1" ] ,
648+ path . dirname ( tarballPath ) ,
649+ {
650+ timeoutMs : resolveTimeoutMs (
651+ "OPENCLAW_DOCKER_PACKAGE_PACK_TIMEOUT_MS" ,
652+ DEFAULT_PACKAGE_PACK_TIMEOUT_MS ,
653+ ) ,
654+ } ,
655+ ) ) ;
650656 const prepareManifest = packageOptions . prepareManifest ?? ( async ( ) => false ) ;
651657 const restoreManifest = packageOptions . restoreManifest ?? ( async ( ) => false ) ;
652658 const originalPackageJson = await fs . readFile ( packageJsonPath , "utf8" ) ;
@@ -831,7 +837,12 @@ async function normalizeOpenClawTarballModes(tarballPath: string) {
831837 ) ;
832838 const stageDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , "openclaw-package-modes-" ) ) ;
833839 try {
834- await run ( "tar" , [ "-xzf" , tarballPath , "-C" , stageDir ] , stageDir , { timeoutMs } ) ;
840+ await run (
841+ "tar" ,
842+ [ "-xzf" , path . basename ( tarballPath ) , "-C" , stageDir ] ,
843+ path . dirname ( tarballPath ) ,
844+ { timeoutMs } ,
845+ ) ;
835846 let stagedFileCount = 0 ;
836847 const normalizeStagedModes = async ( dir : string ) : Promise < void > => {
837848 for ( const entry of await fs . readdir ( dir , { withFileTypes : true } ) ) {
@@ -855,11 +866,16 @@ async function normalizeOpenClawTarballModes(tarballPath: string) {
855866 const stageRootEntries = await fs . readdir ( stageDir ) ;
856867 const normalizedPath = `${ tarballPath } .modes-tmp` ;
857868 await fs . rm ( normalizedPath , { force : true } ) ;
858- await run ( "tar" , [ "-czf" , normalizedPath , "-C" , stageDir , ...stageRootEntries ] , stageDir , {
859- // macOS bsdtar must not add AppleDouble (._*) sidecar entries.
860- env : { ...process . env , COPYFILE_DISABLE : "1" } ,
861- timeoutMs,
862- } ) ;
869+ await run (
870+ "tar" ,
871+ [ "-czf" , path . basename ( normalizedPath ) , "-C" , stageDir , ...stageRootEntries ] ,
872+ path . dirname ( normalizedPath ) ,
873+ {
874+ // macOS bsdtar must not add AppleDouble (._*) sidecar entries.
875+ env : { ...process . env , COPYFILE_DISABLE : "1" } ,
876+ timeoutMs,
877+ } ,
878+ ) ;
863879 await fs . rename ( normalizedPath , tarballPath ) ;
864880 } finally {
865881 await fs . rm ( stageDir , { force : true , recursive : true } ) ;
0 commit comments