Description of problem: The common error of specifying the same file for both oldiso and newiso is not detected by applydeltaiso, except by an infinite loop. This reveals two software bugs: not diagnosing the user error in the first place, and bad copying logic in processrpm() function of src/applydeltaiso.c. "touch foo; /usr/bin/cp foo foo" as input to a shell gives "cp: `foo' and `foo' are the same file" on stderr, with shell exit status 1 [failure], and no actual copying. applydeltaiso should perform similar detection, and if the error is detected then abandon execution with failure status. The SAME_INODE macro in coreutils/lib/same-inode.h gives some hints. The bad copying logic is that 0==read(fd_rpm, buf, 8192) an a .rpm file, especially when repeated many times in a row, is not detected as "no progress now, and likely none in the future". See source excerpt in Additional Information below. Version-Release number of selected component (if applicable): deltaiso-3.6-0.7.20110223git.fc17.x86_64 How reproducible: every time Steps to Reproduce: 1. cp Fedora-17-Final.TC4-x86_64-DVD.iso foo 2. applydeltaiso foo Fedora-17-Final.TC4_TC5-x86_64-DVD.diso foo 3. Actual results: Infinite loop consuming 100% CPU; console output is: ----- reading 309420732 bytes from old iso...done ImageMagick.x86_64: copying unchanged payload ----- and nothing more. Expected results: Error exit with non-zero shell status code, and message on stderr: "foo and foo are the same file" Additional info: Running under gdb, an example traceback is: ----- (gdb) bt #0 0x00000000004022ba in fread (__stream=0x608010, __n=0x2000, __size=0x1, __ptr=0x7fffffff9e80) at /usr/include/bits/stdio2.h:282 #1 processrpm (fpold=fpold@entry=0x608010, ocf=ocf@entry=0x61fb10, cf=cf@entry=0x608490, nmp=nmp@entry=0x619040, nmpn=nmpn@entry=0xd0f) at applydeltaiso.c:155 #2 0x0000000000401ef1 in applydelta (fpold=fpold@entry=0x608010, ocf=0x61fb10, cf=cf@entry=0x608490, outdata=outdata@entry=0x7fffe4b7c010 "ER\b", outlen=outlen@entry=0x127162bc, nmp=nmp@entry=0x619040, nmpn=nmpn@entry=0xd0f) at applydeltaiso.c:330 #3 0x000000000040169a in main (argc=<optimized out>, argv=<optimized out>) at applydeltaiso.c:432 (gdb) up #1 processrpm (fpold=fpold@entry=0x608010, ocf=ocf@entry=0x61fb10, cf=cf@entry=0x608490, nmp=nmp@entry=0x619040, nmpn=nmpn@entry=0xd0f) at applydeltaiso.c:155 155 l = fread(buf, 1, l, fpold); (gdb) l 150 151 len = nmp[i]; 152 while (len) 153 { 154 l = len > sizeof(buf) ? sizeof(buf) : len; 155==> l = fread(buf, 1, l, fpold); 156 if (l <= 0 && ferror(fpold)) 157 { 158 perror("unchanged copy read"); 159 exit(1); 160 } 161 if (ocf->write(ocf, buf, l) != l) 162 { 163 perror("unchanged copy write"); 164 exit(1); 165 } 166 len -= l; 167 } 168 return; -----
I'll take a look at this once I have some time. Thanks for the report!
This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed.