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

Xibo Ning xning at redhat.com
Tue Mar 13 06:10:05 UTC 2012


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: redhat_lsb_trigger.c
Type: text/x-csrc
Size: 17742 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20120313/5b4795b4/attachment-0001.bin>


More information about the devel mailing list