diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e9877a --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +setarch-1.4.tar.gz +setarch-1.5.tar.gz +setarch-1.7.tar.gz +setarch-1.8.tar.gz +setarch-1.9.tar.gz +setarch-2.0.tar.gz diff --git a/dead.package b/dead.package deleted file mode 100644 index 1629489..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -Obsolete, has been merged with util-linux-ng (2.13) diff --git a/setarch-sparc32bash.patch b/setarch-sparc32bash.patch new file mode 100644 index 0000000..7100839 --- /dev/null +++ b/setarch-sparc32bash.patch @@ -0,0 +1,26 @@ +--- setarch-2.0/setarch.c.sparc32bash 2006-04-07 14:35:49.000000000 +0200 ++++ setarch-2.0/setarch.c 2007-01-12 15:37:53.000000000 +0100 +@@ -113,6 +113,7 @@ + #endif + #if defined(__sparc64__) || defined(__sparc__) + {PER_LINUX32, "sparc", "sparc"}, ++ {PER_LINUX32, "sparc32bash", "sparc"}, + {PER_LINUX32, "sparc32", "sparc"}, + {PER_LINUX, "sparc64", "sparc64"}, + #endif +@@ -170,7 +171,14 @@ + if (!strcmp(p, "-h") || !strcmp(p, "--help")) + show_help(); + } +- ++#if defined(__sparc64__) || defined(__sparc__) ++ if (!strcmp(p, "sparc32bash")) { ++ if (set_arch(p, NULL)) ++ error(EXIT_FAILURE, errno, "Failed to set personality to %s", p); ++ execl("/bin/bash", NULL); ++ error(EXIT_FAILURE, errno, "/bin/bash"); ++ } ++#endif + for (argv++, argc--; argc && argv[0][0] == '-'; argv++, argc--) { + int n, unknown = 1; + const char *arg = argv[0]; diff --git a/setarch.spec b/setarch.spec new file mode 100644 index 0000000..14e0abd --- /dev/null +++ b/setarch.spec @@ -0,0 +1,143 @@ +Summary: Personality setter +Name: setarch +Version: 2.0 +Release: 4%{?dist} +Source0: %{name}-%{version}.tar.gz +Patch0: setarch-sparc32bash.patch +License: GPL +Group: System Environment/Kernel +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +%ifarch sparc sparc64 +Obsoletes: sparc32 +%endif + +%description +This utility tells the kernel to report a different architecture than the +current one, then runs a program in that environment. It can also set various +personality flags. + +%prep +%setup -q +%patch0 -p1 -b .sparc32bash + +%build +%{__cc} -o setarch setarch.c $RPM_OPT_FLAGS + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT%{_mandir}/man8 +install -p -m444 setarch.8 $RPM_BUILD_ROOT%{_mandir}/man8 +install -p -m555 setarch $RPM_BUILD_ROOT%{_bindir} + +LINKS="linux32 linux64" +%ifarch s390 s390x +LINKS="$LINKS s390 s390x" +%endif +%ifarch x86_64 i386 +LINKS="$LINKS i386 x86_64" +%endif +%ifarch ppc ppc64 +LINKS="$LINKS ppc ppc64 ppc32" +%endif +%ifarch sparc sparc64 +LINKS="$LINKS sparc sparc64 sparc32 sparc32bash" +%endif +%ifarch mips mips64 +LINKS="$LINKS mips mips64 mips32" +%endif +%ifarch ia64 +LINKS="$LINKS i386 ia64" +%endif +for I in $LINKS; do + ln $RPM_BUILD_ROOT%{_bindir}/setarch $RPM_BUILD_ROOT%{_bindir}/$I + echo ".so setarch.8" > $RPM_BUILD_ROOT%{_mandir}/man8/$I.8 +done + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%{_bindir}/* +%{_mandir}/man8/*.8* + +%changelog +* Tue Feb 20 2007 Jindrich Novy 2.0-4 +- preserve timestamps of installed files +- remove -Wall, it's already in RPM_OPT_FLAGS + +* Fri Jan 12 2007 Jindrich Novy 2.0-3 +- add sparc32bash alias to keep compatibility with sparc32 which + is obsoleted by setarch for some time (#221976), + thanks to Dennis Gilmore + +* Tue Nov 7 2006 Jindrich Novy 2.0-2 +- use dist tag +- fix BuildRoot + +* Wed Jul 12 2006 Jesse Keating - 2.0-1.1 +- rebuild + +* Thu Apr 7 2006 Jindrich Novy 2.0-1 +- better error handling, thanks to Dmitry V. Levin (#187322) +- understand --help + +* Tue Feb 21 2006 Jindrich Novy 1.9-1 +- applied some features proposed by Mike Frysinger (#182219) +- add mips arch support, add sparc32 +- Obsoletes sparc32 +- add '-h' option to display more comprehensive help +- add linux64 helper + +* Fri Feb 10 2006 Jesse Keating - 1.8-1.2.1 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 1.8-1.2 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Thu Jun 30 2005 Jindrich Novy 1.8-1 +- fix possible segfault when parsing unknown arguments (#161975) +- print wanings when unknown arguments are passed +- add FDPIC_FUNCPTRS personality + +* Mon May 9 2005 Bill Nottingham 1.7-3 +- don't strip binary, fixes debuginfo generation + +* Mon Mar 07 2005 Jindrich Novy 1.7-2 +- rebuilt with gcc4 + +* Fri Feb 04 2005 Jindrich Novy 1.7-1 +- Add '-R' option for ADDR_NO_RANDOMIZE + (patch from Arjan van de Ven) +- Minor code cleanup + +* Wed Nov 03 2004 Elliot Lee 1.6-1 +- More properly interpret the return value of SYS_personality + +* Tue Oct 12 2004 Jindrich Novy 1.5-1 +- Add various personality options #130511 +- Update man page + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Wed Feb 24 2004 Elliot Lee 1.4-1 +- Fix man page - #115552 + +* Wed Jan 14 2004 Elliot Lee 1.3-2 +- Rebuild + +* Tue Sep 02 2003 Elliot Lee 1.3-1 +- Add linux32 alias + +* Tue Aug 26 2003 Elliot Lee 1.2-1 +- Fix -3 option + +* Wed Aug 13 2003 Elliot Lee 1.1-1 +- Add -3 option + +* Wed Jun 11 2003 Elliot Lee +- Initial build. diff --git a/sources b/sources new file mode 100644 index 0000000..6bcb298 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +f9d5dcbb2bd5994b062725e7ac57acac setarch-2.0.tar.gz