Обсуждение: Re: [PATCHES] pg_regress breaks on msys
Bruce Momjian <bruce@momjian.us> writes: > I checked on MinGW and system() just returns the value returned by the > application. There isn't any special two-values-in-one layering like is > done on Unix for wait() and the return value from system(). It seems if > the child dies from a signal, the parent dies too, at least in my C > tests. The cases that I think we most need to defend against are (A) diff program not found (B) diff fails to read one of the input files I think your proposal handles case B, because diff should return exit code 2 which we will detect, but what happens in case A? Please test it. regards, tom lane
Tom Lane wrote: > Bruce Momjian <bruce@momjian.us> writes: > > I checked on MinGW and system() just returns the value returned by the > > application. There isn't any special two-values-in-one layering like is > > done on Unix for wait() and the return value from system(). It seems if > > the child dies from a signal, the parent dies too, at least in my C > > tests. > > The cases that I think we most need to defend against are > > (A) diff program not found > > (B) diff fails to read one of the input files > > I think your proposal handles case B, because diff should return exit > code 2 which we will detect, but what happens in case A? Please test it. It returns 1. -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
Bruce Momjian wrote: > Tom Lane wrote: > > Bruce Momjian <bruce@momjian.us> writes: > > > I checked on MinGW and system() just returns the value returned by the > > > application. There isn't any special two-values-in-one layering like is > > > done on Unix for wait() and the return value from system(). It seems if > > > the child dies from a signal, the parent dies too, at least in my C > > > tests. > > > > The cases that I think we most need to defend against are > > > > (A) diff program not found > > > > (B) diff fails to read one of the input files > > > > I think your proposal handles case B, because diff should return exit > > code 2 which we will detect, but what happens in case A? Please test it. > > It returns 1. In summary, on MinGW, files differ or 'diff' not found, returns 1. If one of the files to be compared does not exist, it returns 2. And of course, if the files are the same, it returns zero. I assume MSVC builds will have problem with the diff call. -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
Bruce Momjian <bruce@momjian.us> writes: >> Tom Lane wrote: >>> The cases that I think we most need to defend against are >>> (A) diff program not found > In summary, on MinGW, files differ or 'diff' not found, returns 1. If > one of the files to be compared does not exist, it returns 2. And of > course, if the files are the same, it returns zero. OK. The problem here is that pg_regress is coded to assume that zero-length output file represents success. Given the above Windows behavior that is *clearly* not good enough, because that's probably exactly what we will see after diff-not-found (if the Windows shell acts like a Unix shell does and creates the ">" target first). I'd suggest modifying the logic so that zero-length output file with a nonzero return from the child be treated as a fatal condition (not just a difference, but bail out). regards, tom lane