This is the mail archive of the
cygwin-apps@sources.redhat.com
mailing list for the Cygwin project.
Patch for rpm, 1. Hanging up in the "Finding Provides:" step (bugin win9x), 2. The "-V, --verify" option, and 3. Touching (utime) a read-onlyfile.
- To: cygwin-apps at cygwin dot com, rebum at cygwin dot cjb dot net, Michael Ring <m dot ring at ndh dot net>
- Subject: Patch for rpm, 1. Hanging up in the "Finding Provides:" step (bugin win9x), 2. The "-V, --verify" option, and 3. Touching (utime) a read-onlyfile.
- From: Anon Sricharoenchai <ans at beethoven dot cpe dot ku dot ac dot th>
- Date: Sat, 27 Jan 2001 23:42:57 +0700 (ICT)
I have attached 3 patches on rpm-3.0.5 for cygwin-win9x.
1. The patch for for the bug in cygwin-win9x, that it hangs
up at the finding provides step during building a package,
Finding Provides: (using /usr/lib/rpm/find-provides)...
, as discussed in the following forum.
http://pub30.ezboard.com/fcygwinfrm1.showMessage?topicID=2.topic
This is because rpm will wait for EOF of the output piped from the
"find-provides" program, but win9x can't detect an EOF on that
non-blocking pipe.
2. The next patch is a fix for the problem that cygwin interprete the
path, such as "//usr/bin/abc", as a samba path, so that it can't
access the file "/usr/bin/abc". This problem has been fixed by
Michael Ring <m.ring@ndh.net>, but with -V or --verity option, it
hasn't been fixed. When rpm is invoked like,
$ rpm -V <package-name>
, rpm always report every files in the package as a "missing" file.
3. Next, I have fixed calling utime() on a read-only file. The
problem is that cygwin can't touch a read-only file. Michael Ring has
fixed this by ignore any error return from utime(), but this will
cause the files with read-only permission been installed with an
incorrect timestamp. So, I fixed this problem by first chmod u+w
every files before calling utime(), after utime()-ing I set the file
permission back to what it should be.
I have built my own rpm package with my patch base on
"rpm-3.0.5-27mdk.src.rpm" from Mandrake 7.2. My package also includes
some patch about BUFSIZ, find-provides and find-requires from Michael
Ring.
The .tgz binary version is available at,
http://naist.cpe.ku.ac.th/~ans/release/cygwin/tar/
The .rpm binary versions are available at,
http://naist.cpe.ku.ac.th/~ans/release/cygwin/RPMS/
The .src.rpm version is available at,
http://naist.cpe.ku.ac.th/~ans/release/cygwin/SRPMS/
--- rpm-3.0.5.orig/build/files.c Mon Jul 10 04:33:50 2000
+++ rpm-3.0.5.developed/build/files.c Wed Jan 24 20:54:08 2001
@@ -1529,6 +1529,24 @@ int processSourceFiles(Spec spec)
return fl.processingFailed;
}
+#if 0 && defined(_WIN9X) && defined(__CYGWIN__)
+static int piped_child_pid = 0;
+static int piped_child_die = 0;
+static void piped_child_handler(int signum) {
+ pid_t child_pid;
+ for (; (child_pid = waitpid(-1, NULL, WNOHANG)) > 0; ) {
+ if (child_pid == piped_child_pid) piped_child_die = 1;
+ };
+/* if (
+ piped_child_pid > 0 &&
+ piped_child_pid == waitpid(piped_child_pid, NULL, WNOHANG)
+ ) {
+ } else {
+ if (old_child_handler) (*old_child_handler)(signum);
+ };*/
+};
+#endif
+
static StringBuf getOutputFrom(char *dir, char *argv[],
const char *writePtr, int writeBytesLeft,
int failNonZero)
@@ -1540,6 +1558,9 @@ static StringBuf getOutputFrom(char *dir
void *oldhandler;
StringBuf readBuff;
int done;
+#if defined(_WIN9X) && defined(__CYGWIN__)
+ int has_waited = 0;
+#endif
oldhandler = signal(SIGPIPE, SIG_IGN);
@@ -1638,6 +1659,27 @@ top:
/* terminate on (non-blocking) EOF or error */
done = (nbr == 0 || (nbr < 0 && errno != EAGAIN));
+#if defined(_WIN9X) && defined(__CYGWIN__)
+ /* fix for cygwin on win9x which can't determine EOF on a
+ non-blocking pipe */
+ if (
+ /* nbr < 0 && errno == EAGAIN && */
+ !done && nbr < 0 &&
+ !has_waited && waitpid(progPID, &status, WNOHANG) == progPID
+ ) {
+ long old_flag = fcntl(fromProg[0], F_GETFL);
+ fcntl(fromProg[0], F_SETFL, old_flag & ~O_NONBLOCK);
+ /* Read the remaining data from prog */
+ { char buf[BUFSIZ+1];
+ while ((nbr = read(fromProg[0], buf, sizeof(buf)-1)) > 0) {
+ buf[nbr] = '\0';
+ appendStringBuf(readBuff, buf);
+ }
+ }
+ has_waited = 1;
+ done = 1;
+ };
+#endif
} while (!done);
@@ -1649,6 +1691,9 @@ top:
(void)signal(SIGPIPE, oldhandler);
/* Collect status from prog */
+#if defined(_WIN9X) && defined(__CYGWIN__)
+ if (!has_waited)
+#endif
(void)waitpid(progPID, &status, 0);
if (failNonZero && (!WIFEXITED(status) || WEXITSTATUS(status))) {
rpmError(RPMERR_EXEC, _("%s failed"), argv[0]);
--- rpm-3.0.5.orig/lib/rpmdb.c Tue Jan 23 16:54:48 2001
+++ rpm-3.0.5.developed/lib/rpmdb.c Wed Jan 24 23:58:18 2001
@@ -81,6 +81,12 @@ static int openDbFile(const char * prefi
}
strcat(filename, dbpath);
strcat(filename, shortName);
+#if defined(__CYGWIN__)
+ /* fix for the error message like,
+ "cannot open file //var/lib/rpm/nameindex.rpm: No such host or network path"
+ , that cygwin interprete //var/lib as a samba path */
+ rpmCleanPath(filename);
+#endif
if (!justCheck || !rpmfileexists(filename)) {
*db = dbiOpenIndex(filename, mode, perms, type);
--- rpm-3.0.5.orig/lib/uninstall.c Tue Jul 11 01:30:46 2000
+++ rpm-3.0.5.developed/lib/uninstall.c Wed Jan 24 22:59:12 2001
@@ -171,7 +171,15 @@ int removeBinaryPackage(const char * pre
if (prefixlen) {
strcpy(fileName, prefix);
rpmCleanPath(fileName);
+#if defined(__CYGWIN__)
+ /* fix for the error message like,
+ "cannot open file //var/lib/rpm/nameindex.rpm: No such host or network path"
+ , that cygwin interprete //var/lib as a samba path */
+ prefixlen = (fileName && !(fileName[0] == '/' && fileName[1] == '\0'))
+ ? strlen(fileName) : 0;
+#else
prefixlen = strlen(fileName);
+#endif
} else
*fileName = '\0';
--- rpm-3.0.5.orig/lib/verify.c Wed Jun 14 19:34:32 2000
+++ rpm-3.0.5.developed/lib/verify.c Thu Jan 25 02:07:56 2001
@@ -102,6 +102,12 @@ int rpmVerifyFile(const char * prefix, H
strlen(baseNames[filenum]) + strlen(prefix) + 5);
sprintf(filespec, "%s/%s%s", prefix, dirNames[dirIndexes[filenum]],
baseNames[filenum]);
+#if defined(__CYGWIN__)
+ /* fix for the error message like,
+ "cannot open file //var/lib/rpm/nameindex.rpm: No such host or network path"
+ , that cygwin interprete //var/lib as a samba path */
+ rpmCleanPath(filespec);
+#endif
free(baseNames);
free(dirNames);
--- rpm-3.0.5.orig/lib/cpio.c Mon Jul 17 07:04:56 2000
+++ rpm-3.0.5.developed/lib/cpio.c Fri Jan 26 02:08:50 2001
@@ -269,10 +269,19 @@ static int setInfo(struct cpioHeader * h
if (!S_ISLNK(hdr->mode)) {
if (!getuid() && chown(hdr->path, hdr->uid, hdr->gid))
rc = CPIOERR_CHOWN_FAILED;
+#if defined(__CYGWIN__)
+ if (!rc && chmod(hdr->path, (hdr->mode|S_IWUSR) & 07777))
+ rc = CPIOERR_CHMOD_FAILED;
+ if (!rc && utime(hdr->path, &stamp))
+ rc = CPIOERR_UTIME_FAILED;
+ if (!rc && chmod(hdr->path, hdr->mode & 07777))
+ rc = CPIOERR_CHMOD_FAILED;
+#else
if (!rc && chmod(hdr->path, hdr->mode & 07777))
rc = CPIOERR_CHMOD_FAILED;
if (!rc && utime(hdr->path, &stamp))
rc = CPIOERR_UTIME_FAILED;
+#endif
} else {
# if ! CHOWN_FOLLOWS_SYMLINK
if (!getuid() && !rc && lchown(hdr->path, hdr->uid, hdr->gid))
@@ -428,6 +437,12 @@ static int expandSymlink(FD_t cfd, const
return 0;
}
+#if defined(__CYGWIN__)
+int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev ));
+int _EXFUN(mkfifo,( const char *__path, mode_t __mode )) {
+ return mknod(__path, __mode | S_IFIFO, 0);
+};
+#endif
/** */
static int expandFifo( /*@unused@*/ FD_t cfd, const struct cpioHeader * hdr)
{