[Cooker] Bug of /usr/lib/rpm/find-requires (rpm-build-4.0.4-5mdk) in finding scriptlist, caused by mdk patch

2002-06-13 Thread Anon Sricharoenchai

Bug of /usr/lib/rpm/find-requires (rpm-build-4.0.4-5mdk) in finding scriptlist, caused 
by mdk patch

There's some bugs in /usr/lib/rpm/find-requires from rpm-build-4.0.4-5mdk.
This bug is resulted from the patch, rpm-4.0.4-autoreq.patch.bz2, in
rpm-build-4.0.4-5mdk.src.rpm.
The following is the patch lines that cause this bug.

# --- Grab the file manifest and classify files.
filelist=`sed "s/['\"]/\\\&/g"`
exelist=`echo $filelist | xargs -r file | egrep -v ":.* (commands|script) " | \
  grep ":.*executable" | cut -d: -f1`
   -scriptlist=`echo $filelist | xargs -r file | \
   +scriptlist=`echo $filelist | grep -v /usr/doc | grep -v /usr/share/doc | xargs -r 
file | \
  egrep ":.* (commands|script) " | cut -d: -f1`
liblist=`echo $filelist | xargs -r file | \
  grep ":.*shared object" | cut -d : -f1`

Now, first assume that the input from stdin is as follow.

   /usr/bin/some_script.pl
   /usr/doc/some_doc

By the statement, filelist=`sed "s/['\"]/\\\&/g"`, the input lines passed via
stdin will be turned into only one line and be kept in $filelist,
$filelist == "/usr/bin/some_script.pl /usr/doc/some_doc".
The bug will occur when this whole one line be grepped out by the statement,
grep -v /usr/doc | grep -v /usr/share/doc, so that the /usr/bin/some_script.pl
won't be detected as a script as it should be.

One solution is to use the statement, xargs -r --max-args=1, to turn the
$filelist into lines as follow.

   scriptlist=`echo $filelist | xargs -r --max-args=1 | grep -v /usr/doc | grep -v 
/usr/share/doc | xargs -r file | \
  egrep ":.* (commands|script) " | cut -d: -f1`

But from my experiment, the option, --max-args=1, will cause xargs to
run very slow.

Another faster solution is

   scriptlist=`echo " $filelist" | sed 's| /usr\(/share\)\?/doc[^ ]*||g' | xargs -r 
file | \
  egrep ":.* (commands|script) " | cut -d: -f1`

Note the leading space in " $filelist", which is important in detecting
the beginning of each filename.

>From my experiment, the second solution runs about 2.25 times faster than
the first solution.
But the first solution is less complex, and more elegant.





[Cooker] bug in php 4.0.6 about semaphores

2002-06-11 Thread Anon Sricharoenchai

Semaphores isn't released automatically.
See http://bugs.php.net/bug.php?id=13490

This will cause some php applications to be unusable,
especially, the applications that use the sem_acquire command,
for example, horde/IMP ( http://www.horde.org/imp/ ).
This bug doesn't occur in php 4.0.4 and php 4.1.x.

As seen in,
http://www.mandrakelinux.com/en/security/2002/MDKSA-2002-017.php?dis=8.0 ,
php in many Mandrake releases has been updated to 4.0.6, which has this
bug.
So, will Mandrake or Redhat plan to fix this bug by updating those old
releases by php 4.1.x ?
I have tried to put php 4.1.2 (from Mandrake 8.2) into my Mandrake 8.1
box, but there are many conflict dependencies that I can't resolve.





[Cooker] Bug in wget 1.5.3, the characters ";/?=&+" must retain their encoded/decoded status.

2000-12-08 Thread Anon Sricharoenchai


As per RFC1738 (http://www.w3.org/Addressing/rfc1738.txt, [Page 3]),
the characters ";", "/", "?", ":", "@", "=" and "&" should not be encoded
or decoded by wget, because they have a special meaning.  Encoding or
decoding these characters may change the semantics of a URL.

For example, "http://abc.xyz/abc?def" and "http://abc.xyz/abc%3Fdef" are
not the same location.  But when invoking the command

$ wget 'http://abc.xyz/abc%3Fdef'

, wget will change "%3F" to be "?" that will lead to the wrong location.


Also, the "+" character (not listed in RFC), should retain its
encoded/decoded status.  Because it have the different meaning when
appear in a CGI query.  For example,

"http://abc.xyz/abc.cgi?var1=a+b" means that var1 = "a b"
"http://abc.xyz/abc.cgi?var1=a%2Bb" means that var1 = "a+b"


The following is a patch for this bug to wget 1.5.3.


diff -ur wget-1.5.3.orig/src/url.c wget-1.5.3/src/url.c
--- wget-1.5.3.orig/src/url.c   Fri Sep 11 07:23:26 1998
+++ wget-1.5.3/src/url.cMon Oct 23 19:49:04 2000
@@ -51,6 +51,12 @@
 /* URL separator (for findurl) */
 #define URL_SEPARATOR "!\"#'(),>`{}|<>"
 
+/* A list of characters reserved for special meaning, as per RFC1738.
+   Encoding or decoding these characters may change the semantics of a URL.
+   '+' was added because "+" and "%2B" have the different meaning when they
+   appear in a cgi query. */
+#define URL_RESERVED ";/?:@=&" "+"
+
 /* A list of unsafe characters for encoding, as per RFC1738.  '@' and
':' (not listed in RFC) were added because of user/password
encoding, and \033 for safe printing.  */
@@ -73,6 +79,16 @@
 }  \
 } while (0)
 
+#define URL_CLEANSE2(s, url_unsafe) do \
+{  \
+  if (1)   \
+{  \
+  char *uc_tmp = encode_string2 (s, url_unsafe);\
+  free (s);\
+  (s) = uc_tmp;\
+}  \
+} while (0)
+
 /* Is a directory "."?  */
 #define DOTP(x) ((*(x) == '.') && (!*(x + 1)))
 /* Is a directory ".."?  */
@@ -184,7 +200,7 @@
literally.  */
 
 static void
-decode_string (char *s)
+decode_string (char *s, const char *url_reserved)
 {
   char *p = s;
 
@@ -203,6 +219,13 @@
  continue;
}
  *p = (ASC2HEXD (*(s + 1)) << 4) + ASC2HEXD (*(s + 2));
+  if (strchr(url_reserved, *p))
+   {
+ *p = '%';
+  *(s + 1) = toupper(*(s + 1));
+  *(s + 2) = toupper(*(s + 2));
+ continue;
+   }
  s += 2;
}
 }
@@ -237,6 +260,46 @@
   *p = '\0';
   return res;
 }
+
+char *
+encode_string2 (const char *s, const char *url_unsafe)
+{
+  const char *b;
+  char *p, *res;
+  int i;
+
+  b = s;
+  for (i = 0; *s; s++, i++)
+{
+  if (*s == '%' && *(s + 1) && *(s + 2)
+  && (ISXDIGIT (*(s + 1)) && ISXDIGIT (*(s + 2
+continue;
+  if (strchr (url_unsafe, *s))
+i += 2; /* Two more characters (hex digits) */
+}
+  res = (char *)xmalloc (i + 1);
+  s = b;
+  for (p = res; *s; s++)
+{
+  if (*s == '%' && *(s + 1) && *(s + 2)
+  && (ISXDIGIT (*(s + 1)) && ISXDIGIT (*(s + 2
+{
+  *p++ = *s;
+  continue;
+}
+  if (strchr (url_unsafe, *s))
+{
+  const unsigned char c = *s;
+  *p++ = '%';
+  *p++ = HEXD2ASC (c >> 4);
+  *p++ = HEXD2ASC (c & 0xf);
+}
+  else
+*p++ = *s;
+}
+  *p = '\0';
+  return res;
+}
 
 /* Returns the proto-type if URL's protocol is supported, or
URLUNKNOWN if not.  */
@@ -471,12 +534,22 @@
   /* Parse the username and password (if existing).  */
   parse_uname (url, &u->user, &u->passwd);
   /* Decode the strings, as per RFC 1738.  */
-  decode_string (u->host);
-  decode_string (u->path);
+  decode_string (u->host, "");
+  // To prevent the case that, "%%32%36" => "%26" (that char(26) == '&') //
+  // that it should be, "%%32%36" => "%2526" //
+  // So, quote the unsafe "%" //
+  {
+char* path_temp = xstrdup (u->path);
+URL_CLEANSE2 (path_temp, "%");
+free (u->path); u->path = (char *)xmalloc (strlen (path_temp) + 8);
+strcpy (u->path, path_temp);
+free (path_temp);
+  };
+  decode_string (u->path, URL_RESERVED "%" URL_UNSAFE);
   if (u->user)
-decode_string (u->user);
+decode_string (u->user, "");
   if (u->passwd)
-decode_string (u->passwd);
+decode_string (u->passwd, "");
   /* Parse the directory.  */
   parse_dir (u->path, &u->dir, &u->file);
   DEBUGP (("dir %s -> file %s -> ", u->dir, u->file));
@@ -498,7 +571,7 @@
   strcat (u->path, abs_ftp ? (u->dir + 1) : u->dir);
   strcat (u->path, *u->dir ? "/" : "");
   strcat (u->path, u->file);
-  URL_CLEANSE (u->path);
+  URL_CLEANSE2 (u->path, URL_UNSAFE);
   /* Create 

[Cooker] "fork" and then "copy-on-write" can crash linux.

2000-11-10 Thread Anon Sricharoenchai


I have tested the "fork" and so called "copy-on-write" operation by
invoking the following command (as a normal user, not superuser).

perl -e '$| = 1; sub s1() { system("free -t | tail -1") } s1(); for ($i =
0; $i<10_000_000; $i++) { $a[$i] = 0 } s1(); if (\!fork()) { s1(); for ($i
= 0; $i


[Cooker] Re: sawmill is crashed by using gnumeric

2000-09-22 Thread Anon Sricharoenchai


There's some clue about this bug.

If the following option of sawmill is set, then sawmill will not hang.

3.1 open gnomecc (Gnome Control Center)
3.2 select "Sawmill window manager"->"Placement"
3.3 change the "Method of selecting the position of a freshly-mapped
transient window" option from "randomly" to be "best-fit", then click
"OK"

Also, the setting of
"Method of selecting the position of a freshly-mapped window" (not
transient window) option to be "randomly" will cause many application to
crash sawmill.  So, both options (normal and transient window) should not
be set to "randomly", that will cause a serious bug.

On Tue, 19 Sep 2000, Anon Sricharoenchai wrote:
> 
> Follow these step to regenerate this bug.
> 
> 1. use Mandrake 7.1
> 
> 2. create new user
>$ useradd test1 -p ''
> 
> 3. login into gnome/sawmill desktop as user test1
> 
> 4. open gnumeric application
> 
> 5. select some texts from some X terminals to copy that texts into
>X clipboard
> 
> 6. click menu Edit->Paste in gnumeric application
> 
> 7. The X system will then hang. Sawmill will hang and eat 99% cpu time.
> 





[Cooker] sawmill is crashed by using gnumeric

2000-09-19 Thread Anon Sricharoenchai


Follow these step to regenerate this bug.

1. use Mandrake 7.1

2. create new user
   $ useradd test1 -p ''

3. login into gnome/sawmill desktop as user test1

4. open gnumeric application

5. select some texts from some X terminals to copy that texts into
   X clipboard

6. click menu Edit->Paste in gnumeric application

7. The X system will then hang. Sawmill will hang and eat 99% cpu time.





[Cooker] QPainter::drawImage Bug in Qt 1.44

2000-08-29 Thread Anon Sricharoenchai


Package: qt
Version: 1.44-26mdk

When I use the method,
QPainter::drawImage(int x, int y, const QImage &, int sx=0, int sy=0, int sw, int sh);
, the region of the QImage is incorrectly copied onto the paint device.


I have attached a patch file to fix this bug.  This patch is used to apply
in qt-1.45, but it can also be used to patch the 1.44 version.


  diff -ur qt-1.45/src/kernel/qpainter.cpp qt-1.45.fixed/src/kernel/qpainter.cpp
  --- qt-1.45/src/kernel/qpainter.cpp Fri Nov 12 23:57:27 1999
  +++ qt-1.45.fixed/src/kernel/qpainter.cpp   Fri Aug 25 01:42:07 2000
  @@ -1670,7 +1670,7 @@
   if ( image.rect().intersect(QRect(sx,sy,sw,sh)) == image.rect() )
  subimage = image;
   else
  -   subimage = image.copy(sx,sy,sw,wh);
  +   subimage = image.copy(sx,sy,sw,sh);
  
   QPixmap pm;
   pm.convertFromImage( subimage );


I have suggested this to Trolltech, but they told that they have already 
freezed the qt-1.xx maintenance.  But I still need qt-1.xx, because when I 
develop my KDE application, qt2 doesn't work with the kdelibs-1.1.2 
that come with mandrake 7.1 distribution.

Can you suggest me how to link qt2 with kdelibs-1.1.2 ?  Or I have to use
KDE 2.0 ?


Regards,
Anon Sricharoenchai.


diff -ur qt-1.45/src/kernel/qpainter.cpp qt-1.45.fixed/src/kernel/qpainter.cpp
--- qt-1.45/src/kernel/qpainter.cpp Fri Nov 12 23:57:27 1999
+++ qt-1.45.fixed/src/kernel/qpainter.cpp   Fri Aug 25 01:42:07 2000
@@ -1670,7 +1670,7 @@
 if ( image.rect().intersect(QRect(sx,sy,sw,sh)) == image.rect() )
subimage = image;
 else
-   subimage = image.copy(sx,sy,sw,wh);
+   subimage = image.copy(sx,sy,sw,sh);
 
 QPixmap pm;
 pm.convertFromImage( subimage );