Hot answers tagged

66

You cannot update glibc on Centos 6 safely. However you can install 2.14 alongside 2.12 easily, then use it to compile projects etc. Here is how: mkdir ~/glibc_install; cd ~/glibc_install wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz tar zxvf glibc-2.14.tar.gz cd glibc-2.14 mkdir build cd build ../configure --prefix=/opt/glibc-2.14 make -j4 ...


60

I ran this: strace -o spork.out bash -c "echo 1234 >> some-file" to figure out your question. This is what I found: open("some-file", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3 No file named "some-file" existed in the directory in which I ran the echo command.


50

This is not only done in Bash, it's required by the standard. From the Single Unix Specification: Appended output redirection shall cause the file whose name results from the expansion of word to be opened for output on the designated file descriptor. The file is opened as if the open() function as defined in the System Interfaces volume of POSIX.1-2008 ...


50

That library has a main() function or equivalent entry point, and was compiled in such a way that it is useful both as an executable and as a shared object. Here's one suggestion about how to do this, although it does not work for me. Here's another in an answer to a similar question on S.O, which I'll shamelessly plagiarize, tweak, and add a bit of ...


32

Looking in the source, it does use O_APPEND. For bash 4.3.30 in make_cmd.c line 710-713 read: case r_appending_to: /* >>foo */ case r_append_err_and_out: /* &>> filename */ temp->flags = O_APPEND | O_WRONLY | O_CREAT; break;


24

Technically, i686 is actually a 32-bit instruction set (part of the x86 family line), while x86_64 is a 64-bit instruction set (also referred to as amd64). From the sound of it, you have a 64-bit machine that has 32-bit libraries for backwards compatibility. That should be totally fine.


23

You don't have to switch to the unstable to get glib >= 2.14. In fact, the testing branch (now stable, or Jessie) has glib-2.17 which you can pick just adding the testing repository and launching: sudo apt-get install libc6-dev=2.17-7 or, sudo apt-get -t testing install libc6-dev You can add the switch --dry-run to see what will being installed before ...


22

In my situation, the error appears when I try to run an application (compiled on Ubuntu 12.04 LTS) using GLIBC_2.14 on Debian Wheezy (which installs glibc 2.13 by default). I use a tricky way to run it, and get correct result: Download libc6 and libc6-dev from Ubuntu 12.04 LTS Run dpkg command to install them into a directory (/home/user/fakeroot/ for ...


20

Answer to my question, from Qualys: During our testing, we developed a proof-of-concept in which we send a specially created e-mail to a mail server and can get a remote shell to the Linux machine. This bypasses all existing protections (like ASLR, PIE and NX) on both 32-bit and 64-bit systems. My compiled research below for anyone else looking: ...


20

Let's dive for an answer in random glibc repo in github. This version provides a „banner“ at file version.c: https://github.com/lattera/glibc/blob/a2f34833b1042d5d8eeb263b4cf4caaea138c4ad/csu/version.c In same file there is a few interesting points: __libc_print_version the function that provides printing to stdin same text and symbol __libc_main (void) ...


19

Let's investigate that using strace on a local (non-NFS) filesystem: $ strace -eopen -- bash -c "echo foo >> /tmp/testfile000" 2>&1 | grep /tmp/testfile000 open("/tmp/testfile000", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3 $ strace -eopen -- bash -c "echo foo > /tmp/testfile000" 2>&1 | grep /tmp/testfile000 open("/tmp/testfile000", ...


19

You have upgraded your libc (the most basic system library) and now no program works. To be precise, no dynamically linked program works. In your particular scenario, rebooting should work. The now-installed libc requires a newer kernel, and if you reboot, you should get that newer kernel. As long as you still have a running shell, there's often a way to ...


18

You're missing a file which would be used to default the locale in the absence of $LANG or $LC_ALL (or all of the more specific $LC_whatever) being set. On older glibc, it's /usr/lib/locale/locale-archive. Because GNU/Linux is chaotic, you should use strace to determine which files are expected in the particular versions in use on your machine: strace -e ...


16

The Solaris C library is not based on the GNU C Library. They both implement the C standard and POSIX interfaces and some other standards, but they don't share a common heritage beyond that. Solaris libc.so.1 traces its history to the AT&T System V C library. GNU libc.so.6 is based on glibc 2.0 or greater. The earlier versions (e.g. libc.so.5) of ...


10

You can definitely compile a new version of GLIBC and have it stored in a separate directory. The first thing you'll have to do is download the version of glibc that you want from http://ftp.gnu.org/gnu/glibc/. Run the configure script and set the --prefix= to something like /home/you/mylibs. After you've managed to install it into that directory, you'll ...


10

The path to the loader is compiled into the binary as you discovered with your hex editor. You actually got lucky that editing the binary directly worked because both /lib/ld-linux.so.2 and /home/chroot/ld.so are the same length. The lengths of those strings are also in the binary and you can cause subtle problems if you modify the strings directly. If you ...


9

To be a tiny bit more explicit than @Miroslav answer: 1 The dependencies #64-bit (`x86_64`) C library and headers yum install libgcc yum install glibc-devel # 32-bit (‘i386’) C library and headers yum install libgcc.i686 yum install glibc-devel.i686 See all of them in GCC Prerequesites. 2 Then compile with --enable-multilib ../configure --enable-...


9

make itself has likely not much to do with the problem. The symptoms are typical of using wrong toolchain and/or libraries. The output indicates that the linker in use is the stock Fedora ld, which on 64bit Fedora would mean a toolchain capable of producing x86_64 binaries. skipping incompatible /usr/lib/libc.a tells you, that the linker tried linking ...


9

When a program starts, it receives its environment as an array of pointers to some strings in the format var=value. On Linux, those are located at the bottom of the stack. At the very bottom, you have all the strings tucked one after the other (that's what's shown in /proc/pid/environ). And above you have an array of pointers (NULL terminated) to those ...


9

I was having this exact issue when creating a Docker image. First installing yum-plugin-ovl, which is a yum plugin for the Docker overlay fs, fixed the issue for me. Example: ... RUN yum -y update \ && yum -y install yum-plugin-ovl \ && yum -y install gcc ... See this GitHub issue for more information on the fix.


8

getent ahosts uses getaddrinfo() and extracts from the addrinfo struct the values of ai_addr, ai_socktype, and ai_canonname and prints them out in order as: IPv4/IPv6 address, socket type, and canonical name (if it has one). SOCK_STREAM (reliable stream-oriented service or Stream Sockets) SOCK_DGRAM (datagram service or Datagram Sockets) SOCK_SEQPACKET (...


8

For me worked sudo package-cleanup --cleandupes


8

The trick is that, in a manner of speaking, sorting is done in multiple passes. Every character has three (or sometimes more) weights assigned to it. Let's say for this example the weights are space = [0000.0020.0002] A = [1BC2.0020.0008] The create the sort key, the nonzero weights of the characters of a string are concatenated, one weight level at ...


8

Do you have a file named a? $ echo [:alnum:] $ touch a $ echo [:alnum:] a Quote your strings. $ echo '[:alnum:]' | tr -d '[:alnum:]' [::]


8

They are certainly case sensitive in the glibc resolver libraries. Note the use of strncmp (case sensitive compare) rather than strncasecmp (case insensitive compare) in the MATCH function within glibc res_init.c. This code is responsible for reading + parsing the /etc/resolv.conf file. #define MATCH(line, name) \ (!strncmp(line, name, sizeof(name) -...


8

How can I parse argument using C? POSIX provides getopt for parsing command-line arguments. On Linux systems, the GNU C library provides an extended getopt_long function that allows for long named parameters in addition to the single-character flags supported by plain getopt. In linux, pressing 'tab' auto fills the command. I would like to have similar ...


7

For some versions of glibc, the announcement email says which kernel versions are compatible. glibc Released Kernel ---------------------------------------------------------- 2.27 2 Feb 2018 (same as 2.26?) 2.26 2 Aug 2017 3.2 2.25 5 Feb 2017 (same as 2.24?) 2.24 4 Aug 2016 on i[4567]86 and x86_64 -> 2.6.32 2.24 ...


7

Context: assuming from above comments that a BSDish libc is meant. I think it's been looked into, but libc tends to be tightly tied to a given kernel (glibc has an abstraction layer, which allows it some portability but causes the usual problems that an abstraction layer causes) and making BSD libc work with a Linux kernel would require a near complete ...


7

Resolving yum-updates for my RHEL 6.4 (Fedora 12+) environment was time-consuming but ultimately successful. I want to share what I did, and what could have been better. I identified all package duplicates. Presumably package-clean --dupes does the same. Another helpful command was rpm -qa package-name, which identified duplicate packages by prefix or ...


7

To install glibc 2.14 in parallel, add the configure prefix: tar zxvf glibc-2.14.tar.gz cd glibc-2.14 mkdir build cd build ../configure --prefix=/opt/glibc-2.14 make -j4 make install Following this process, you'll be able to build 2.14 but you will need to tell the compiler where to look for glibc. Below are the ways you can expose the glibc to your ...


Only top voted, non community-wiki answers of a minimum length are eligible