Compare commits

...

No commits in common. "c8s" and "c10s" have entirely different histories.
c8s ... c10s

9 changed files with 367 additions and 54 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/lockdev-1.0.4.20111007git.tar.gz
lockdev_1.0.3.orig.tar.gz
/lockdev-1.0.4.20111007git.tar.gz

View File

@ -1,36 +0,0 @@
From 1cc25ae8129e399ed76f1ef85be1b7f53f61bc51 Mon Sep 17 00:00:00 2001
From: Sebastian Kisela <skisela@redhat.com>
Date: Mon, 6 Aug 2018 17:06:35 +0200
Subject: [PATCH] Fix manpages NAME section
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
According to lexgrog manpage:
"Some manual pagers require the \- to be exactly as shown;
mandb is more tolerant, but for compatibility with other systems
it is nevertheless a good idea to retain the backslash."
Fix the wording to make the man page check pass.
Fixes: #1612764
---
docs/lockdev.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/lockdev.8 b/docs/lockdev.8
index a7c117f..8739211 100644
--- a/docs/lockdev.8
+++ b/docs/lockdev.8
@@ -4,7 +4,7 @@
.\" Man page written by Jiri Popelka <jpopelka AT redhat DOT com>
.\"
.SH NAME
-\fBLockdev\fR is a setgid binary,
+\fBLockdev\fR \- a setgid binary,
which provides a reliable way to put an exclusive lock
in /var/lock to devices (e.g. ttyS0) using both FSSTND and SVr4 methods,
so regular users don't need write access there.
--
2.14.4

1
ci.fmf Normal file
View File

@ -0,0 +1 @@
resultsdb-testcase: separate

View File

@ -0,0 +1,237 @@
diff --git a/../lockdev.c b/src/lockdev.c
index ec86f65..26c1ba5 100644
--- a/../lockdev.c
+++ b/src/lockdev.c
@@ -547,6 +547,7 @@ dev_testlock(const char *devname)
* and minor numbers
*/
if ( stat( device, &statbuf) == -1 ) {
+ free(p);
close_n_return(-errno);
}
@@ -556,8 +557,10 @@ dev_testlock(const char *devname)
*/
/* lockfile of type /var/lock/LCK..ttyS2 */
_dl_filename_2( lock, p);
- if ( (pid=_dl_check_lock( lock)) )
+ if ( (pid=_dl_check_lock( lock)) ) {
+ free(p);
close_n_return( pid);
+ }
/* and also check if a pid file was left around
* do this before the static var is wiped
@@ -575,15 +578,17 @@ dev_testlock(const char *devname)
* the contrary; anyway we do both tests.
*/
if (_dl_filename_1( lock, &statbuf)) {
- if ( (pid=_dl_check_lock( lock)) )
+ if ( (pid=_dl_check_lock( lock)) ) {
+ free(p);
close_n_return( pid);
+ }
if ( pid_read ) {
_dl_filename_0( lock, pid_read);
_dl_check_lock( lock);
}
}
-
+ free(p);
close_n_return( 0);
}
@@ -623,12 +628,14 @@ dev_lock (const char *devname)
* and minor numbers
*/
if ( stat( device, &statbuf) == -1 ) {
+ free(p);
close_n_return(-errno);
}
/* check that the caller has write permission to the device
* to prevent denial-of-service attack by unauthorized users
*/
if ( LOCKDEV_ACCESS( device, W_OK ) == -1 ) {
+ free(p);
close_n_return(-errno);
}
@@ -645,8 +652,10 @@ dev_lock (const char *devname)
*/
/* file of type /var/lock/LCK..<pid> */
_dl_filename_0( lock0, our_pid);
- if ( ! (fd=fopen( lock0, "w")) )
+ if ( ! (fd=fopen( lock0, "w")) ) {
+ free(p);
close_n_return( -errno); /* no file, no lock */
+ }
fprintf( fd, "%10d\n", (int)our_pid);
fclose( fd);
@@ -659,6 +668,7 @@ dev_lock (const char *devname)
pid = _dl_check_lock( lock2);
if ( pid && pid != our_pid ) {
unlink( lock0);
+ free(p);
close_n_return( pid); /* error or locked by someone else */
}
if ( pid_read ) { /* modifyed by _dl_check_lock() */
@@ -675,12 +685,14 @@ dev_lock (const char *devname)
if (( link( lock0, lock1) == -1 ) && ( errno != EEXIST )) {
int rc = -errno;
unlink( lock0);
+ free(p);
close_n_return(rc);
}
}
if ( pid != our_pid ) {
/* error or another one owns it now */
unlink( lock0);
+ free(p);
close_n_return( pid);
}
if ( pid_read ) { /* modifyed by _dl_check_lock() */
@@ -696,6 +708,7 @@ dev_lock (const char *devname)
int rc = -errno;
unlink( lock0);
if (*lock1) unlink( lock1);
+ free(p);
close_n_return(rc);
}
}
@@ -707,6 +720,7 @@ dev_lock (const char *devname)
*/
unlink( lock0);
if (*lock1) unlink( lock1);
+ free(p);
close_n_return( pid);
}
/* quite unlike, but ... */
@@ -733,6 +747,7 @@ dev_lock (const char *devname)
if (( pid == pid2 ) && ( pid == our_pid )) {
_debug( 2, "dev_lock() got lock\n");
+ free(p);
close_n_return( 0); /* locked by us */
}
/* oh, no! someone else stepped in! */
@@ -749,8 +764,10 @@ dev_lock (const char *devname)
_debug( 1, "dev_lock() process %d owns file %s\n", (int)pid, lock1);
_debug( 1, "dev_lock() process %d owns file %s\n", (int)pid2, lock2);
_debug( 1, "dev_lock() process %d (we) have no lock!\n", (int)our_pid);
+ free(p);
close_n_return(pid);
}
+ free(p);
close_n_return( (pid + pid2));
}
@@ -790,12 +807,14 @@ dev_relock (const char *devname,
* and minor numbers
*/
if ( stat( device, &statbuf) == -1 ) {
+ free(p);
close_n_return(-errno);
}
/* check that the caller has write permission to the device
* to prevent denial-of-service attack by unauthorized users
*/
if ( LOCKDEV_ACCESS( device, W_OK ) == -1 ) {
+ free(p);
close_n_return(-errno);
}
@@ -810,13 +829,17 @@ dev_relock (const char *devname,
/* lockfile of type /var/lock/LCK..ttyS2 */
_dl_filename_2( lock2, p);
pid = _dl_check_lock( lock2);
- if ( pid && old_pid && pid != old_pid )
+ if ( pid && old_pid && pid != old_pid ) {
+ free(p);
close_n_return( pid); /* error or locked by someone else */
+ }
if (_dl_filename_1( lock1, &statbuf)) {
pid = _dl_check_lock( lock1);
- if ( pid && old_pid && pid != old_pid )
+ if ( pid && old_pid && pid != old_pid ) {
+ free(p);
close_n_return( pid); /* error or locked by someone else */
+ }
}
if ( ! pid ) { /* not locked ??? */
@@ -828,8 +851,10 @@ dev_relock (const char *devname,
* we own all the lockfiles
*/
if (*lock1) {
- if ( ! (fd=fopen( lock1, "w")) )
+ if ( ! (fd=fopen( lock1, "w")) ) {
+ free(p);
close_n_return( -errno); /* something strange */
+ }
fprintf( fd, "%10d\n", (int)our_pid);
fclose( fd);
}
@@ -837,13 +862,16 @@ dev_relock (const char *devname,
* the first, so we have yet modifyed it also, and this write
* seems redundant ... but ... doesn't hurt.
*/
- if ( ! (fd=fopen( lock2, "w")) )
+ if ( ! (fd=fopen( lock2, "w")) ) {
/* potentially a problem */
+ free(p);
close_n_return( -errno); /* something strange */
+ }
fprintf( fd, "%10d\n", (int)our_pid);
fclose( fd);
_debug( 2, "dev_relock() lock changed\n");
+ free(p);
close_n_return( 0); /* locked by us */
}
@@ -883,12 +911,14 @@ dev_unlock (const char *devname,
* and minor numbers
*/
if ( stat( device, &statbuf) == -1 ) {
+ free(p);
close_n_return(-errno);
}
/* check that the caller has write permission to the device
* to prevent denial-of-service attack by unauthorized users
*/
if ( LOCKDEV_ACCESS( device, W_OK ) == -1 ) {
+ free(p);
close_n_return(-errno);
}
@@ -899,13 +929,16 @@ dev_unlock (const char *devname,
/* lockfile of type /var/lock/LCK..ttyS2 */
_dl_filename_2( lock2, p);
wpid = _dl_check_lock( lock2);
- if ( pid && wpid && pid != wpid )
+ if ( pid && wpid && pid != wpid ) {
+ free(p);
close_n_return( wpid); /* error or locked by someone else */
-
+ }
if (_dl_filename_1( lock1, &statbuf)) {
wpid = _dl_check_lock( lock1);
- if ( pid && wpid && pid != wpid )
+ if ( pid && wpid && pid != wpid ) {
+ free(p);
close_n_return( wpid); /* error or locked by someone else */
+ }
}
_dl_filename_0( lock0, wpid);
@@ -918,6 +951,7 @@ dev_unlock (const char *devname,
unlink( lock2);
if (*lock1) unlink( lock1);
_debug( 2, "dev_unlock() unlocked\n");
+ free(p);
close_n_return( 0); /* successfully unlocked */
}

25
gating.yaml Normal file
View File

@ -0,0 +1,25 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/tier1-public.functional}
#Rawhide
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/tier1-public.functional}
#gating rhel
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tier1-public.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tier1-internal.functional}

View File

@ -10,9 +10,8 @@
Summary: A library for locking devices
Name: lockdev
Version: 1.0.4
Release: 0.28.%{checkout}%{?dist}
License: LGPLv2
Group: System Environment/Libraries
Release: 0.46.%{checkout}%{?dist}
License: LGPL-2.1-or-later
URL: https://alioth.debian.org/projects/lockdev/
# This is a nightly snapshot downloaded via
@ -21,7 +20,7 @@ Source0: lockdev-%{version}.%{checkout}.tar.gz
Patch1: lockdev-euidaccess.patch
Patch2: 0001-major-and-minor-functions-moved-to-sysmacros.h.patch
Patch3: 0001-Fix-manpages-NAME-section.patch
Patch3: free-dl-check-devname-result.patch
Requires(pre): shadow-utils
Requires(post): glibc
@ -34,6 +33,7 @@ BuildRequires: libtool
BuildRequires: perl-interpreter
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: systemd
BuildRequires: make
%description
Lockdev provides a reliable way to put an exclusive lock to devices
@ -41,7 +41,6 @@ using both FSSTND and SVr4 methods.
%package devel
Summary: The header files for the lockdev library
Group: System Environment/Libraries
Requires: lockdev = %{version}-%{release}
%description devel
@ -56,7 +55,7 @@ package contains the development headers.
# Replace access() calls with euidaccess() (600636#c33)
%patch1 -p1 -b .access
%patch2 -p1
%patch3 -p1
%patch3 -p1 -b .memleak-fix
%build
# Generate version information from git release tag
@ -94,15 +93,11 @@ EOF
getent group lock >/dev/null 2>&1 || groupadd -g 54 -r -f lock >/dev/null 2>&1 || :
%post
/sbin/ldconfig
if [ $1 -eq 1 ] ; then
# for the time until first reboot
%tmpfiles_create
%tmpfiles_create lockdev.conf
fi
%postun -p /sbin/ldconfig
%files
%{license} COPYING
%doc AUTHORS
@ -119,18 +114,72 @@ fi
%{_includedir}/*
%changelog
* Mon Aug 06 2018 Sebastian Kisela <skisela@redhat.com> - 1.0.4-0.28.
- Fix man page wording to pass errors detected by lexgrog.
Fixes: 1612764
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.0.4-0.46.20111007git
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.27.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Aug 21 2024 Pavol Žáčik <pzacik@redhat.com> - 1.0.4-0.45.20111007git
- Fix memory leaks found by static analysis
- Resolves: RHEL-39379
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.0.4-0.44.20111007git
- Bump release for June 2024 mass rebuild
* Tue May 21 2024 Pavol Žáčik <pzacik@redhat.com> - 1.0.4-0.43.20111007git
- Use an SPDX license tag
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.42.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.41.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.40.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.39.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.38.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.37.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.36.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.35.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.34.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.33.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Oct 30 2019 Kalev Lember <klember@redhat.com> - 1.0.4-0.32.20111007git
- Fix the build with latest rpmbuild (#1736075)
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.31.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Mar 07 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.0.4-0.30.20111007git
- Remove obsolete scriptlets
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.29.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jul 25 2018 Sebastian Kisela <skisela@redhat.com> - 1.0.4-0.28.
- Explicitly include <sys/sysmacros.h> due to glibc-headers changes.
Definition of major and minor macros is no longer transitively included
through <sys/types.h>, hence make it explicit.
Ref:
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS;hb=HEAD
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.27.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-0.26.20111007git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

36
plans.fmf Normal file
View File

@ -0,0 +1,36 @@
/tier1-internal:
plan:
import:
url: https://src.fedoraproject.org/tests/lockdev.git
name: /plans/tier1/internal
/tier1-public:
plan:
import:
url: https://src.fedoraproject.org/tests/lockdev.git
name: /plans/tier1/public
/tier2-tier3-internal:
plan:
import:
url: https://src.fedoraproject.org/tests/lockdev.git
name: /plans/tier2-tier3/internal
/tier2-tier3-public:
plan:
import:
url: https://src.fedoraproject.org/tests/lockdev.git
name: /plans/tier2-tier3/public
/others-internal:
plan:
import:
url: https://src.fedoraproject.org/tests/lockdev.git
name: /plans/others/internal
/others-public:
plan:
import:
url: https://src.fedoraproject.org/tests/lockdev.git
name: /plans/others/public

View File

@ -1 +1 @@
SHA512 (lockdev-1.0.4.20111007git.tar.gz) = 19741a22aae5ff54b94815e7bb5c94e32a99c14a916451e385c6b795b4adb3041708aa5c9bbcffa889a6370d469602b2d34534a73d57af9701b64258690408e3
c0015d1bcd155b51df688467ed34137f lockdev-1.0.4.20111007git.tar.gz