LinearTapeFileSystem / LinearTapeFileSystem/ltfs

Issue during compilation with glibc >= 2.30

Open
#389 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue Hacktoberfest help wanted
Dominant language
C
Stars
352
Forks
110
Avg merge
2h 50m
Merged PRs (30d)
2

Description

On Linux systems which use glibc ≥2.30 the following will be logged
during compilation:

In file included from arch/arch_info.c:52:0: /usr/include/sys/sysctl.h:21:2: error: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror=cpp] #warning "The <sys/sysctl.h> header is deprecated and will be removed." ^~~~~~~ cc1: all warnings being treated as errors

The release notes for glibc 2.30 read:

“The Linux-specific <sys/sysctl.h> header and the sysctl function have
been deprecated and will be removed from a future version of glibc.
Application should directly access /proc instead. For obtaining
random bits, the getentropy function can be used.”

(See also https://sourceware.org/ml/libc-alpha/2019-08/msg00029.html for
the full release notes.)

To Reproduce

1 install glibc and glibc-dev / glibc-devel >= 2.30

2 compile ltfs v. 2.4.5.0 :
./autogen.sh
./configure --prefix=$1 --enable-message-checker --enable-warning-as-error
make

Solution

Because of the deprecated sysctl() function, sysconf() should be used instead.

Source file src/libltfs/arch/arch_info.c

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/libltfs/arch/arch_info.c and reproduce the warning using glibc >=2.30 with the configure options shown. Inspect the deprecated sysctl usage and update the affected path to use sysconf, then run make with warning-as-error enabled to confirm compilation succeeds without the deprecation warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.