@@ -300,6 +300,31 @@ describe.skipIf(HostProcess.Platform.defaultValue() === "win32")("installAppImag
300300 assert . isFalse ( NodeFS . existsSync ( input . installerPath ) ) ;
301301 } ) ;
302302
303+ it ( "keeps the destination when the same path reports different inode numbers" , ( ) => {
304+ const input = fixture ( "T3-Code-1.2.2-x86_64.AppImage" ) ;
305+ const installerPath = NodePath . join ( input . applications , NodePath . basename ( input . installerPath ) ) ;
306+ NodeFS . renameSync ( input . installerPath , installerPath ) ;
307+ const stat = vi . mocked ( NodeFS . statSync ) . getMockImplementation ( ) as (
308+ ...args : Array < unknown >
309+ ) => NodeFS . BigIntStats ;
310+ let inodeOffset = 0n ;
311+ vi . mocked ( NodeFS . statSync ) . mockImplementation ( ( ( path : NodeFS . PathLike , options ?: unknown ) => {
312+ const result = stat ( path , options ) ;
313+ if ( String ( path ) === installerPath && typeof result . ino === "bigint" ) {
314+ return { ...result , ino : result . ino + inodeOffset ++ } ;
315+ }
316+ return result ;
317+ } ) as unknown as typeof NodeFS . statSync ) ;
318+ const destination = installAppImageUpdate ( {
319+ ...input ,
320+ installerPath,
321+ sha512 : sha512 ( NEW_APPIMAGE ) ,
322+ } ) ;
323+ assert . equal ( destination , installerPath ) ;
324+ assert . equal ( NodeFS . readFileSync ( destination , "utf8" ) , NEW_APPIMAGE ) ;
325+ assert . isFalse ( NodeFS . existsSync ( input . appImageFile ) ) ;
326+ } ) ;
327+
303328 it ( "rejects an empty source even when its digest matches" , ( ) => {
304329 const input = fixture ( ) ;
305330 NodeFS . writeFileSync ( input . installerPath , "" ) ;
0 commit comments