From l.grunwald at dn-systems.de Sun Feb 12 19:31:40 2006 From: l.grunwald at dn-systems.de (Lukas Grunwald) Date: Sun Feb 12 19:32:04 2006 Subject: [Slad] TEST Message-ID: <43EF8D1C.6070907@dn-systems.de> TEST -- Gruss Lukas Grunwald aka REG lg1 http://www.dn-systems.de mail: l.grunwald@dn-systems.de DN-Systems Enterprise Internet Solutions GmbH Hornemannstr. 11 31137 Hildesheim, Germany Tel. +49-5121-28989-0 Fax. +49-5121-28989-11 1110 Laguna Ave #4, Burlingame, CA 94010, USA Tel. +1-650-472-2512 Mob. +1-650-200-7889 Handelsregister HRB-3213 Amtsgericht Hildesheim Gesch?ftsf?hrer Lukas Grunwald -------------- next part -------------- A non-text attachment was scrubbed... Name: l.grunwald.vcf Type: text/x-vcard Size: 326 bytes Desc: not available Url : http://lists.dn-systems.net/pipermail/slad/attachments/20060212/1ed937a4/l.grunwald.vcf From jan at intevation.de Sun Feb 12 22:03:40 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Sun Feb 12 22:03:42 2006 Subject: [Slad] sladinstaller: patch for a bugfix Message-ID: <20060212220340.GA32255@intevation.de> Hi, attached a patch that fixes correct use of gtk function. Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de -------------- next part -------------- Index: gtk.cpp =================================================================== RCS file: /anoncvs/sladinstaller/gtk.cpp,v retrieving revision 1.46 diff -u -3 -p -r1.46 gtk.cpp --- gtk.cpp 12 Feb 2006 15:22:01 -0000 1.46 +++ gtk.cpp 12 Feb 2006 21:58:51 -0000 @@ -145,14 +145,14 @@ void LOG(std::string str) static void ERROR(const gchar *str) { - GtkWidget*m=gtk_message_dialog_new(GTK_WINDOW(NULL/*mainwindow*/), GtkDialogFlags(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT), GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, str); + GtkWidget*m=gtk_message_dialog_new(GTK_WINDOW(NULL/*mainwindow*/), GtkDialogFlags(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT), GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", str); gtk_dialog_run(GTK_DIALOG(m)); gtk_object_destroy(GTK_OBJECT(m)); } static void SUCCESS(const gchar *str) { - GtkWidget*m=gtk_message_dialog_new(GTK_WINDOW(NULL/*mainwindow*/), GtkDialogFlags(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT), GTK_MESSAGE_INFO, GTK_BUTTONS_OK, str); + GtkWidget*m=gtk_message_dialog_new(GTK_WINDOW(NULL/*mainwindow*/), GtkDialogFlags(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT), GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", str); gtk_dialog_run(GTK_DIALOG(m)); gtk_object_destroy(GTK_OBJECT(m)); } From jan at intevation.de Mon Feb 13 10:00:58 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Mon Feb 13 10:01:06 2006 Subject: [Slad] Patch for Windows: don't use popen from stock cygwin Message-ID: <20060213100058.GA18672@intevation.de> Hi, attached is a patch that introduces 'our' popen implementation. It was necessary because the cygwin popen somehow does not handle all file descriptors correctly. I tested it successfully on a Debian Sarge as well. The patch has been written by Bernhard Herzog. Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de From jan at intevation.de Mon Feb 13 10:01:37 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Mon Feb 13 10:01:41 2006 Subject: [Slad] Re: Patch for Windows: don't use popen from stock cygwin In-Reply-To: <20060213100058.GA18672@intevation.de> References: <20060213100058.GA18672@intevation.de> Message-ID: <20060213100137.GB18672@intevation.de> On Mon, Feb 13, 2006 at 11:00:58AM +0100, Jan-Oliver Wagner wrote: > attached is a patch that introduces 'our' popen implementation. and now it is $%&$% -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de -------------- next part -------------- Index: tools.cpp =================================================================== RCS file: /anoncvs/sladinstaller/tools.cpp,v retrieving revision 1.21 diff -u -3 -p -r1.21 tools.cpp --- tools.cpp 25 Nov 2005 17:04:21 -0000 1.21 +++ tools.cpp 13 Feb 2006 09:55:21 -0000 @@ -16,9 +16,12 @@ #include #include #include +#include +#include #include #include #include +#include #define _(a) gettext (a) @@ -577,6 +580,47 @@ std::string installonclient(void *ssh_se return ret; } +static FILE* +mypopen(const char * dir, char ** argv, pid_t * p_pid) +{ + int ret; + pid_t pid; + int thepipe[2]; + + if (pipe(thepipe) < 0) + { + LOG(std::string(_("\nerror creating pipes"))); + return 0; + } + + pid = fork(); + if (pid == 0) + { + if (chdir(dir) < 0) + { + exit(127); + } + dup2(thepipe[1], 1); + dup2(thepipe[1], 2); + for (int i = 3 ; i < getdtablesize(); i++ ) + close(i); + ret = execvp(argv[0], argv); + if (ret) + exit(127); + else + exit(0); + } + if ( pid < 0 ) + { + LOG(std::string(_("\nerror starting subprocess "))); + return 0; + } + + close(thepipe[1]); + *p_pid = pid; + return fdopen(thepipe[0], "r"); +} + std::string checkpackage(const std::string& pkg) { LOG(std::string("\n")+_("check")+' '+pkg+'\n'); @@ -587,13 +631,13 @@ std::string checkpackage(const std::stri if(tolower(pkg[pkg.size()-3])=='b' && tolower(pkg[pkg.size()-2])=='z' && pkg[pkg.size()-1]=='2') tarcmd="tfj"; - std::string cmd="tar "; - cmd+=tarcmd; - cmd+=' '; - cmd+=pkg; - FILE *f=popen(cmd.c_str(), "r"); + char * cmd[] = { "tar", (char*)tarcmd.c_str(), (char *)pkg.c_str(), 0}; + pid_t tar_pid; + LOG(std::string("\ntar command: ")+cmd[0]+" "+ cmd[1]+" "+ cmd[2]); + FILE *f=mypopen(".", cmd, &tar_pid); if(!f) - return std::string(SLAD_ERROR)+' '+_("could not execute")+": "+cmd; + return std::string(SLAD_ERROR) +' '+_("could not execute")+": " + +cmd[0]+" "+ cmd[1]+" "+ cmd[2]; bool ok=false; std::string dir; while(!feof(f)) @@ -617,7 +661,21 @@ std::string checkpackage(const std::stri dir=d; } } - pclose(f); + fclose(f); + + while (true) + { + int ret; + pid_t e = waitpid(tar_pid, &ret, 0); + if (e < 0 && errno == EINTR) + continue; + ret = WEXITSTATUS(ret); + std::ostringstream msg; + msg << "\ntar result " << ret; + if (ret != 0) + return std::string(SLAD_ERROR)+' '+msg.str(); + break; + } if(!ok) return std::string(SLAD_ERROR)+' '+_("did not find slad-install.sh in")+": "+pkg; From l.grunwald at dn-systems.de Mon Feb 13 16:50:17 2006 From: l.grunwald at dn-systems.de (Lukas Grunwald [c]) Date: Mon Feb 13 16:52:09 2006 Subject: [Slad] List of platform where SLAD probably runs? [u] Message-ID: <43F0B8C9.30101@dn-systems.de> Jan-Oliver Wagner wrote: > Hi, > > I would like to have a list of platforms where > SLAD-2 1.0 will likely run (Distribution names and version, > perhaps Kernel versions). Due to static linking only two limitations are left. 1. The resulting ABI. If compiled e.g. on a current Gentoo Linux with NPTL only support, it will only run on Kernel 2.6.5+/2.6.6+ (Linux ABI). This can be checked with the "file" utility, e.g. [~]> file /opt/slad/bin/sladd /opt/slad/bin/sladd: setuid ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.6, statically linked, for GNU/Linux 2.6.6, not stripped indicates a minimal kernel version of 2.6.6. This limitation is imposed by the toolchain, not SLAD itself, as threads are not used. Building on as old a distribution as possible, e.g. Debian Stale, would broaden the range of usable distributions. A reasonable assumption should be Kernel 2.4. Debian Sarge (3.1) e.g. is build for ABI 2.2.0, allowing even older kernels. 2. The more difficult limitation is a result from the setuid/setgid functions. As we do not use numeric uid/gid, we use getpwnam() and getgrnam() to get the numeric values. This yields while compiling: process.c:268: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking rocess.c:266: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking A small test has shown that a missing dynamic libc makes these calls fail, which is a handled case. The result is that the started plugins runs at uid/gid 0/0. Having the sladd run with a different glibc version than it is build against may create problems, though. Still the functions inside the dynamic libc are versioned and have not changed, so I expect the same behaviour with an incompatible glibc version: objdump -T /lib32/libc.so.6 | grep getgrnam 00087120 g DF .text 000001b0 GLIBC_2.1.2 getgrnam_r 000f1b50 g DF .text 00000058 (GLIBC_2.0) getgrnam_r 00086910 g DF .text 0000011c GLIBC_2.0 getgrnam for a 32bit glibc up to 2.3.6, which is the current version. It seems safe to assume glibc 2.1.2 as the minimum level required, though the release of 2.3 has been in 2002, and 2.3.4 (e.g. Debian Sarge) is from January 2005. All distributions which meet these requirements (kernel 2.2 or higher, glibc 2.1.2 or higher) should work, kernel 2.4 and glibc 2.3.4 or higher should be safe assumptions for a sladd build on Debian Sarge. Please bear in mind that this discussion only is about the sladd executable and doesn't necessarrily mean all plugins will work. These would have to be tested separately. Fast testing shows that the system Lukas chose for building sets the ABI to 2.4.1, requireing this minimum kernel for the plugins. Additional requirements may arise from scripted plugins, such as perl/bash/python/whatever versions. Regards, Christian > Does it already exist? > If not, can you quickly hack up a list where chances > are good that SLAD runs on? > > Thanks > Jan -- Gruss Lukas Grunwald aka REG lg1 http://www.dn-systems.de mail: l.grunwald@dn-systems.de DN-Systems Enterprise Internet Solutions GmbH Hornemannstr. 11 31137 Hildesheim, Germany Tel. +49-5121-28989-0 Fax. +49-5121-28989-11 1110 Laguna Ave #4, Burlingame, CA 94010, USA Tel. +1-650-472-3194 Mob. +1-650-200-7889 Handelsregister HRB-3213 Amtsgericht Hildesheim Gesch?ftsf?hrer Lukas Grunwald