Build: add --enable-warnings (-Wall -Wextra); the tree is now warning-free with it, so distributions can opt in without risking a surprise -Werror breakage from a future compiler. Real bugs fixed (each verified by a reproducer): - lib/io.c: open_rollback_file() read 28 bytes into char[28] with no NUL and then strcmp()'d it against a 28-character magic, reading one byte past the array. The condition was also inverted, so a *valid* rollback file was rejected -- but only sometimes: the missing NUL made the result depend on stack garbage (verified: -O0 rejects, -O2 accepts). The whole --save-rollback/--rollback-changes path was unreliable. Now the buffer is sized for the terminator, zeroed, and the comparison is `!= 0`. Verified end to end: save -> reopen -> restore reports "2 blocks restored, 0 skipped"; a random file is rejected. - reiserfscore/reiserfslib.c, reiserfscore/journal.c: asprintf() was called with &fs->fs_file_name / &fs->fs_j_file_name, but those fields are `char *`, not `char **`. Passing a `char **` where `char *` is expected wrote through the wrong pointer -- silent memory corruption on any allocation. Fixed by using the new checked helper. - reiserfscore/node_formats.c: `code < 0` on an unsigned parameter was dead code; the guard never fired. - resize_reiserfs: missing `break` after -j made -j fall into -f, so "-j dev" silently also forced the operation. Sign-compare on the count_blocks() ternary and on count + blocks. - lib/misc.c: strncat with bound == strlen(src) (equivalent to strcat) into char[256] from a char[256] dirent name -- up to 261 bytes. Replaced with snprintf plus an explicit fit check. - lib/misc.c: die() used vsprintf into a fixed 1024-byte buffer. - strncpy with bound == destination size (mkreiserfs, tune, progbar) never terminated; replaced with snprintf. Allocator: drop the homegrown magic-header allocator. It wrote "_mem_begin_" / "mem_end" through strcpy inside the allocation, kept the size in an `int`, and its only safety check (checkmem) was never called -- every call site is commented out. Replaced with a size_t header that is over-aligned via max_align_t, so malloc alignment guarantees still hold. expandmem() now takes the old size from the header instead of a caller-supplied value that could disagree with it. Warnings: annotate the deliberate fallthroughs (fsck pass cascade, unit suffix parsing, percentage parsing), fix the remaining sign-compare and missing-field-initializer sites, and compute addresses of packed members via char* + offsetof instead of &member. Portability: asm/types.h -> linux/types.h, malloc.h and sys/vfs.h dropped from includes.h (nothing used them), sys/vfs.h -> sys/statfs.h for statfs(2). Version: reiserfsprogs.spec said 3.6.23 while configure.ac said 3.6.25. Remove the dead `#if 0` main() from hashes.c. Add .github/workflows/build.yml: gcc, clang, --enable-warnings and --enable-io-failure-emulation, each followed by a format/check/inspect smoke test on a real image. Verified: ./autogen.sh && ./configure --enable-warnings && make is clean from scratch (0 warnings, 51 compile/link steps). mkreiserfs, reiserfsck --check, debugreiserfs -S, reiserfstune -l and a real resize_reiserfs 128M -> 256M all succeed, and fsck reports the resized image clean.
86 lines
2.5 KiB
RPMSpec
86 lines
2.5 KiB
RPMSpec
%define reiserfsprogsversion 3.6.25
|
|
|
|
Vendor: Hans Reiser
|
|
Distribution: Hans Reiser
|
|
Name: reiserfsprogs
|
|
Release: 1
|
|
Copyright: 2004 Hans Reiser
|
|
Group: Unsorted
|
|
|
|
Packager: anthon@mnt.org
|
|
|
|
Version: %{reiserfsprogsversion}
|
|
Summary: utilities belonging to the Reiser filesystem
|
|
Source: reiserfsprogs-%{reiserfsprogsversion}.tar.gz
|
|
BuildRoot: %{_tmppath}/rpmbuildroot-%{name}
|
|
%description
|
|
|
|
The reiserfsprogs package contains programs for creating (mkreiserfs),
|
|
checking and correcting any inconsistencies (reiserfsck) and resizing
|
|
(resize_reiserfs) of a reiserfs filesystem.
|
|
|
|
Authors:
|
|
--------
|
|
Hans Reiser <reiser@namesys.com>
|
|
Vitaly Fertman <vitaly@namesys.com>
|
|
Alexander Zarochentcev <zam@namesys.com>
|
|
Vladimir Saveliev <monstr@namesys.com>
|
|
|
|
%prep
|
|
# Jeff Johnson states that RPM doesn't delete obviouse crap like / if
|
|
# buildroot is set differently since RPM 3.0.4 (rpm mailing list 2001-04-10)
|
|
rm -rf $RPM_BUILD_ROOT
|
|
%setup -q -n reiserfsprogs-%{reiserfsprogsversion}
|
|
# %patch
|
|
%build
|
|
MANDIR=$(dirname $(dirname $(man -w fsck | cut -d ' ' -f 1)))
|
|
./configure --prefix="" --mandir=$MANDIR
|
|
%{__make} all
|
|
%install
|
|
mkdir -p $RPM_BUILD_ROOT/sbin
|
|
%{__make} DESTDIR=$RPM_BUILD_ROOT install
|
|
# do we need this?
|
|
cd $RPM_BUILD_ROOT/sbin
|
|
%{__ln_s} -f reiserfsck fsck.reiserfs
|
|
%{__ln_s} -f mkreiserfs mkfs.reiserfs
|
|
|
|
# __os_install_post is normally executed after \%install disable it
|
|
%define ___build_post %{nil}
|
|
# explicitly call it now, so manpages get compressed, exec's stripped etc.
|
|
%{?__os_install_post}
|
|
%define __os_install_post %{nil}
|
|
# now we have all the files execpt for docs, but their owner is unimportant
|
|
cd $RPM_BUILD_ROOT
|
|
|
|
%{__rm} -f rpm-filelist
|
|
# we do not have special directories to make
|
|
#find . -type d \
|
|
# | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' >> rpm-filelist
|
|
find . -type f \
|
|
| sed 's,^\.,\%attr(-\,root\,root) ,' | fgrep -v rpm-filelist >> rpm-filelist
|
|
find . -type l \
|
|
| sed 's,^\.,\%attr(-\,root\,root) ,' >> rpm-filelist
|
|
|
|
%post
|
|
CONFIG=/usr/src/linux/.config
|
|
|
|
if [ -f $CONFIG ] ; then
|
|
source $CONFIG
|
|
fi
|
|
|
|
if [ -z $CONFIG_REISERFS_FS ] ; then
|
|
echo -e "\nIn $CONFIG , you probably have to set:"
|
|
if [ "$CONFIG_EXPERIMENTAL" != "y" ] ; then
|
|
echo -e 'CONFIG_EXPERIMENTAL=y'
|
|
fi
|
|
echo -e 'CONFIG_REISERFS_FS=y\n or'
|
|
echo -e 'CONFIG_REISERFS_FS=m'
|
|
echo -e 'and recompile and reboot your kernel if you cannot use the\nreiserfsprogs utilities'
|
|
fi
|
|
|
|
%clean
|
|
%{__rm} -rf $RPM_BUILD_ROOT
|
|
%files -f %{buildroot}/rpm-filelist
|
|
%defattr(-,root,root)
|
|
%doc README
|