Why we need redhat_lsb_trigger.c in redhat-lsb package?

Xibo Ning xning at redhat.com
Tue Mar 13 06:04:45 UTC 2012

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} \

%triggerpostun -- glibc
if [ -x /usr/sbin/redhat_lsb_trigger.%{_target_cpu} ]; then

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; */
   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);
         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.


Thanks alot

More information about the devel mailing list