Re: Why we need redhat_lsb_trigger.c in redhat-lsb package?
On 03/13/2012 07:04 AM, Xibo Ning wrote: Hi, Do we really need a fineness c program to make symbol link? In redhat-lsb.spec, we can see: snip %triggerpostun -- glibc if [ -x /usr/sbin/redhat_lsb_trigger.%{_target_cpu} ]; then /usr/sbin/redhat_lsb_trigger.%{_target_cpu} fi And in redhat_lsb_trigger.c, the main function is as follows: snip if (is_ia64 ()) INTERNAL_SYSCALL (symlink, err, 2, /emul/ia32-linux/lib/ LDSO, buf); else INTERNAL_SYSCALL (symlink, err, 2, LDSO, buf); snip Why need we use a manually c program, not sln command? We can copy a copy of sln, so we can use it even when glibc is removed. Probably the trigger can be executed at a critical time when no libraries are available, hence the static binary. I guess sln would be an alternative. The best solution would probably be to replace the %triggerpostun with a lua scriptlet, something like this (totally untested and you'll need to add the LSB-version somewhere too): %triggerpostun -p lua -- glibc LDSO = /usr/lib/ld.so LSBLDSO = /usr/lib/ld. + LSB_VERSION + .so %ifarch ia64 LDSO = /emul/ia32-linux/lib + LSBLDSO %fi posix.symlink(LDSO, LSBLDSO) Cheers, Niels -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel
Re: Why we need redhat_lsb_trigger.c in redhat-lsb package?
On Wed, Mar 14, 2012 at 10:08:32AM +0100, Niels de Vos wrote: On 03/13/2012 07:04 AM, Xibo Ning wrote: The best solution would probably be to replace the %triggerpostun with a lua scriptlet, something like this (totally untested and you'll need to add the LSB-version somewhere too): %triggerpostun -p lua -- glibc LDSO = /usr/lib/ld.so LSBLDSO = /usr/lib/ld. + LSB_VERSION + .so %ifarch ia64 LDSO = /emul/ia32-linux/lib + LSBLDSO %fi posix.symlink(LDSO, LSBLDSO) That is not equivalent. is_ia64 () is true in the statically linked binary for %ifarch %{ix86} if running on the ia64 CPU (software emulated). Jakub -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel
Re: Why we need redhat_lsb_trigger.c in redhat-lsb package?
On Wed, Mar 14, 2012 at 10:13 AM, Jakub Jelinek ja...@redhat.com wrote: On Wed, Mar 14, 2012 at 10:08:32AM +0100, Niels de Vos wrote: On 03/13/2012 07:04 AM, Xibo Ning wrote: The best solution would probably be to replace the %triggerpostun with a lua scriptlet, something like this (totally untested and you'll need to add the LSB-version somewhere too): %triggerpostun -p lua -- glibc LDSO = /usr/lib/ld.so LSBLDSO = /usr/lib/ld. + LSB_VERSION + .so %ifarch ia64 LDSO = /emul/ia32-linux/lib + LSBLDSO %fi posix.symlink(LDSO, LSBLDSO) That is not equivalent. is_ia64 () is true in the statically linked binary for %ifarch %{ix86} if running on the ia64 CPU (software emulated). Aha, so is_ia64() does some checks and that makes the decision to have the symlink point to one ld.so or the other. If those checks can be written in lua, replacing redhat_lsb_trigger.c would make sense. Cheers, Niels -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel
Re: Why we need redhat_lsb_trigger.c in redhat-lsb package?
Niels de Vos (de...@fedoraproject.org) said: %triggerpostun -p lua -- glibc LDSO = /usr/lib/ld.so LSBLDSO = /usr/lib/ld. + LSB_VERSION + .so %ifarch ia64 LDSO = /emul/ia32-linux/lib + LSBLDSO %fi posix.symlink(LDSO, LSBLDSO) That is not equivalent. is_ia64 () is true in the statically linked binary for %ifarch %{ix86} if running on the ia64 CPU (software emulated). Aha, so is_ia64() does some checks and that makes the decision to have the symlink point to one ld.so or the other. If those checks can be written in lua, replacing redhat_lsb_trigger.c would make sense. Well, it's not as if ia64 is supported in current Fedora or RHEL releases, so those bits could just be removed... Bill -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel
Why we need redhat_lsb_trigger.c in redhat-lsb package?
Hi, Do we really need a fineness c program to make symbol link? In redhat-lsb.spec, we can see: gcc $RPM_OPT_FLAGS -Os -static -fno-stack-protector -o redhat_lsb_trigger{.%{_target_cpu},.c} -DLSBSOVER='%{lsbsover}' \ -DLDSO='%{ldso}' -DLSBLDSO='/%{_lib}/%{lsbldso}' -D_GNU_SOURCE install -m 700 redhat_lsb_trigger.%{_target_cpu} \ $RPM_BUILD_ROOT%{_sbindir}/redhat_lsb_trigger.%{_target_cpu} %triggerpostun -- glibc if [ -x /usr/sbin/redhat_lsb_trigger.%{_target_cpu} ]; then /usr/sbin/redhat_lsb_trigger.%{_target_cpu} fi And in redhat_lsb_trigger.c, the main function is as follows: int main (int argc, char **argv) { /* redhat_lsb_trigger.c:428: warning: unused variable 'ret' */ /* long ret; */ INTERNAL_SYSCALL_DECL (err); char lsbsover[] = LSBSOVER; char *LSBVER, *p = lsbsover; while ((LSBVER = strtok (p, \t)) != NULL) { char buf[sizeof LSBLDSO + 1 + strlen (LSBVER)]; p = buf; p = mempcpy (p, LSBLDSO, sizeof LSBLDSO - 1); *p++ = '.'; strcpy (p, LSBVER); if (is_ia64 ()) INTERNAL_SYSCALL (symlink, err, 2, /emul/ia32-linux/lib/ LDSO, buf); else INTERNAL_SYSCALL (symlink, err, 2, LDSO, buf); p = NULL; } INTERNAL_SYSCALL (exit, err, 1, 0); return 110; } Why need we use a manually c program, not sln command? We can copy a copy of sln, so we can use it even when glibc is removed. Why? Thanks alot xning -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel
Re: Why we need redhat_lsb_trigger.c in redhat-lsb package?
On 03/13/2012 02:04 PM, Xibo Ning wrote: Hi, Do we really need a fineness c program to make symbol link? In redhat-lsb.spec, we can see: gcc $RPM_OPT_FLAGS -Os -static -fno-stack-protector -o redhat_lsb_trigger{.%{_target_cpu},.c} -DLSBSOVER='%{lsbsover}' \ -DLDSO='%{ldso}' -DLSBLDSO='/%{_lib}/%{lsbldso}' -D_GNU_SOURCE install -m 700 redhat_lsb_trigger.%{_target_cpu} \ $RPM_BUILD_ROOT%{_sbindir}/redhat_lsb_trigger.%{_target_cpu} %triggerpostun -- glibc if [ -x /usr/sbin/redhat_lsb_trigger.%{_target_cpu} ]; then /usr/sbin/redhat_lsb_trigger.%{_target_cpu} fi And in redhat_lsb_trigger.c, the main function is as follows: int main (int argc, char **argv) { /* redhat_lsb_trigger.c:428: warning: unused variable 'ret' */ /* long ret; */ INTERNAL_SYSCALL_DECL (err); char lsbsover[] = LSBSOVER; char *LSBVER, *p = lsbsover; while ((LSBVER = strtok (p, \t)) != NULL) { char buf[sizeof LSBLDSO + 1 + strlen (LSBVER)]; p = buf; p = mempcpy (p, LSBLDSO, sizeof LSBLDSO - 1); *p++ = '.'; strcpy (p, LSBVER); if (is_ia64 ()) INTERNAL_SYSCALL (symlink, err, 2, /emul/ia32-linux/lib/ LDSO, buf); else INTERNAL_SYSCALL (symlink, err, 2, LDSO, buf); p = NULL; } INTERNAL_SYSCALL (exit, err, 1, 0); return 110; } Why need we use a manually c program, not sln command? We can copy a copy of sln, so we can use it even when glibc is removed. Why? Thanks alot xning #ifdef __sparc__ register void *__thread_self __asm (g7); #endif #include unistd.h #include string.h #include fcntl.h #include syscall.h #if defined __i386__ # define INTERNAL_SYSCALL_DECL(err) do { } while (0) # define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ register unsigned int resultvar; \ asm volatile ( \ movl %1, %%eax\n\t \ int $0x80\n\t \ : =a (resultvar) \ : i (__NR_##name) ASMFMT_##nr(args) : memory, cc); \ (int) resultvar; }) # define INTERNAL_SYSCALL_ERROR_P(val, err) \ ((unsigned int) (val) = 0xf001u) # define ASMFMT_0() # define ASMFMT_1(arg1) \ , b (arg1) # define ASMFMT_2(arg1, arg2) \ , b (arg1), c (arg2) # define ASMFMT_3(arg1, arg2, arg3) \ , b (arg1), c (arg2), d (arg3) #elif defined __x86_64__ # define INTERNAL_SYSCALL_DECL(err) do { } while (0) # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ unsigned long resultvar; \ LOAD_ARGS_##nr (args) \ LOAD_REGS_##nr \ asm volatile ( \ syscall\n\t \ : =a (resultvar) \ : 0 (name) ASM_ARGS_##nr : memory, cc, r11, cx); \ (long) resultvar; }) # define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) # define INTERNAL_SYSCALL_ERROR_P(val, err) \ ((unsigned long) (val) = -4095L) # define LOAD_ARGS_0() # define LOAD_REGS_0 # define ASM_ARGS_0 # define LOAD_ARGS_1(a1)\ long int __arg1 = (long) (a1); \ LOAD_ARGS_0 () # define LOAD_REGS_1 \ register long int _a1 asm (rdi) = __arg1; \ LOAD_REGS_0 # define ASM_ARGS_1 ASM_ARGS_0, r (_a1) # define LOAD_ARGS_2(a1, a2)\ long int __arg2 = (long) (a2); \ LOAD_ARGS_1 (a1) # define LOAD_REGS_2 \ register long int _a2 asm (rsi) = __arg2; \ LOAD_REGS_1 # define ASM_ARGS_2 ASM_ARGS_1, r (_a2) # define LOAD_ARGS_3(a1, a2, a3) \ long int __arg3 = (long) (a3); \ LOAD_ARGS_2 (a1, a2) # define LOAD_REGS_3 \ register long int _a3 asm (rdx) = __arg3; \ LOAD_REGS_2 # define ASM_ARGS_3 ASM_ARGS_2, r (_a3) #elif defined __powerpc__ # define INTERNAL_SYSCALL_DECL(err) long int err # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ register long int r0 __asm__ (r0);\ register long int r3 __asm__ (r3);\ register long int r4 __asm__ (r4);\ register long int r5 __asm__ (r5);\ register long int r6 __asm__ (r6);\ register long int r7 __asm__ (r7);\ register long int r8 __asm__ (r8);\ LOADARGS_##nr(name, args); \ __asm__ __volatile__ \ (sc\n\t\ mfcr %0\n\t \ : =r (r0), \ =r (r3), =r (r4), =r (r5),\ =r (r6), =r (r7), =r (r8)\ : ASM_INPUT_##nr \ : r9, r10, r11, r12, \ cr0, ctr, memory); \ err = r0; \ (int) r3; \ }) # define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) # define INTERNAL_SYSCALL_ERROR_P(val, err) \ ((void) (val), __builtin_expect ((err) (1 28), 0)) # define LOADARGS_0(name, dummy) \ r0 = name # define LOADARGS_1(name, __arg1) \ long int arg1 = (long int) (__arg1); \ LOADARGS_0(name, 0); \ r3 = arg1 # define LOADARGS_2(name, __arg1, __arg2) \ long int arg2 = (long int) (__arg2); \ LOADARGS_1(name, __arg1); \ r4 = arg2 # define LOADARGS_3(name, __arg1, __arg2, __arg3) \ long int arg3 = (long int) (__arg3); \ LOADARGS_2(name, __arg1, __arg2); \