- Update to 5.6.3:
* liblzma: - Fix x86-64 inline assembly compatibility with GNU Binutils older than 2.27. - Fix the build with GCC 4.2 on OpenBSD/sparc64. * xzdec: Display an error instead of failing silently if the unsupported option -M is specified. * lzmainfo: Fix integer overflows when rounding the dictionary and uncompressed sizes to the nearest mebibyte. * Autotools-based build: - Fix feature checks with link-time optimization (-flto). - Solaris: Fix a compatibility issue in version.sh. It matters if one wants to regenerate configure by running autoconf. * CMake: - Use paths relative to ${prefix} in liblzma.pc when possible. This is done only with CMake >= 3.20. - Prefer a C11 compiler over a C99 compiler but accept both. - Link Threads::Threads against liblzma using PRIVATE so that -pthread and such flags won't unnecessarily get included in the usage requirements of shared liblzma. That is, target_link_libraries(foo PRIVATE liblzma::liblzma) no longer adds -pthread if using POSIX threads and linking against shared liblzma. The threading flags are still added if linking against static liblzma. * Updated translations: Catalan, Chinese (simplified), and Brazilian Portuguese. OBS-URL: https://build.opensuse.org/package/show/Base:System/xz?expand=0&rev=167
This commit is contained in:
commit
109e1df478
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
4
baselibs.conf
Normal file
4
baselibs.conf
Normal file
@ -0,0 +1,4 @@
|
||||
liblzma5
|
||||
xz-devel
|
||||
requires -xz-<targettype>
|
||||
requires "liblzma5-<targettype> = <version>"
|
BIN
xz-5.6.2.tar.xz
(Stored with Git LFS)
Normal file
BIN
xz-5.6.2.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
xz-5.6.2.tar.xz.sig
Normal file
BIN
xz-5.6.2.tar.xz.sig
Normal file
Binary file not shown.
3
xz-5.6.3.tar.xz
Normal file
3
xz-5.6.3.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:db0590629b6f0fa36e74aea5f9731dc6f8df068ce7b7bafa45301832a5eebc3a
|
||||
size 1328224
|
BIN
xz-5.6.3.tar.xz.sig
Normal file
BIN
xz-5.6.3.tar.xz.sig
Normal file
Binary file not shown.
1262
xz.changes
Normal file
1262
xz.changes
Normal file
File diff suppressed because it is too large
Load Diff
52
xz.keyring
Normal file
52
xz.keyring
Normal file
@ -0,0 +1,52 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBEzEOZIBEACxg/IuXERlDB48JBWmF4NxNUuuup1IhJAJyFGFSKh3OGAO2Ard
|
||||
sNuRLjANsFXA7m7P5eTFcG+BoHHuAVYmKnI3PPZtHVLnUt4pGItPczQZ2BE1WpcI
|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||||
=6rZC
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
218
xz.spec
Normal file
218
xz.spec
Normal file
@ -0,0 +1,218 @@
|
||||
#
|
||||
# spec file for package xz
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
# avoid bootstrapping problem
|
||||
%if 0%{?suse_version} == 1500
|
||||
%bcond_without static
|
||||
%else
|
||||
%bcond_with static
|
||||
%endif
|
||||
|
||||
Name: xz
|
||||
Version: 5.6.3
|
||||
Release: 0
|
||||
Summary: A Program for Compressing Files with the Lempel–Ziv–Markov algorithm
|
||||
License: 0BSD AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.1-or-later
|
||||
Group: Productivity/Archiving/Compression
|
||||
URL: https://tukaani.org/xz/
|
||||
Source0: https://github.com/tukaani-project/xz/releases/download/v%{version}/xz-%{version}.tar.xz
|
||||
Source1: https://github.com/tukaani-project/xz/releases/download/v%{version}/xz-%{version}.tar.xz.sig
|
||||
Source2: baselibs.conf
|
||||
Source3: https://tukaani.org/misc/lasse_collin_pubkey.txt#/xz.keyring
|
||||
Source4: xznew
|
||||
Source5: xznew.1
|
||||
BuildRequires: pkgconfig
|
||||
Provides: lzma = %{version}
|
||||
Obsoletes: lzma < %{version}
|
||||
%{?suse_build_hwcaps_libs}
|
||||
|
||||
%description
|
||||
The xz command is a program for compressing files.
|
||||
* Average compression ratio of LZMA is about 30%% better than that of
|
||||
gzip, and 15%% better than that of bzip2.
|
||||
* Decompression speed is only little slower than that of gzip, being
|
||||
two to five times faster than bzip2.
|
||||
* In fast mode, compresses faster than bzip2 with a comparable
|
||||
compression ratio.
|
||||
* Achieving the best compression ratios takes four to even twelve
|
||||
times longer than with bzip2. However, this does not affect
|
||||
decompressing speed.
|
||||
* Very similar command line interface to what gzip and bzip2 have.
|
||||
|
||||
|
||||
%lang_package
|
||||
|
||||
%package -n liblzma5
|
||||
Summary: Lempel–Ziv–Markov chain algorithm compression library
|
||||
License: 0BSD
|
||||
Group: System/Libraries
|
||||
|
||||
%description -n liblzma5
|
||||
Library for encoding/decoding LZMA files.
|
||||
|
||||
%package devel
|
||||
Summary: Development package for the LZMA library
|
||||
License: 0BSD
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: liblzma5 = %{version}
|
||||
Provides: lzma-devel = %{version}
|
||||
Obsoletes: lzma-devel < %{version}
|
||||
Provides: lzma-alpha-devel = %{version}
|
||||
Obsoletes: lzma-alpha-devel < %{version}
|
||||
|
||||
%description devel
|
||||
This package contains the header files and libraries needed for
|
||||
compiling programs using the LZMA library.
|
||||
|
||||
%if %{with static}
|
||||
%package static-devel
|
||||
Summary: Static version of LZMA library
|
||||
License: SUSE-Public-Domain
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: xz-devel = %{version}
|
||||
|
||||
%description static-devel
|
||||
Static library for the LZMA library
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
|
||||
export CFLAGS="%{optflags} -D_REENTRANT -pipe -fPIE"
|
||||
export LDFLAGS="-Wl,-z,relro,-z,now -pie"
|
||||
|
||||
# Either we build it without pic enabled, or we build one at a time
|
||||
%if %{with static}
|
||||
%configure \
|
||||
--with-pic \
|
||||
--docdir=%{_docdir}/%{name} \
|
||||
--disable-shared CONFIG_SHELL=/bin/sh
|
||||
|
||||
%make_build
|
||||
cp ./src/liblzma/.libs/liblzma.a liblzma.a
|
||||
%endif
|
||||
%configure \
|
||||
--with-pic \
|
||||
--docdir=%{_docdir}/%{name} \
|
||||
--disable-static CONFIG_SHELL=/bin/sh
|
||||
%if 0%{?do_profiling}
|
||||
%make_build CFLAGS="${CFLAGS} %{cflags_profile_generate}"
|
||||
%make_build
|
||||
%make_build clean
|
||||
%make_build CFLAGS="${CFLAGS} %{cflags_profile_feedback}"
|
||||
%else
|
||||
%make_build
|
||||
%endif
|
||||
|
||||
%check
|
||||
%make_build check
|
||||
|
||||
%install
|
||||
%make_install
|
||||
find %{buildroot} -type f -name "*.la" -delete -print
|
||||
%find_lang %{name} --all-name --with-man
|
||||
install -Dpm 0755 %{SOURCE4} %{buildroot}%{_bindir}/xznew
|
||||
install -Dpm 0644 %{SOURCE5} %{buildroot}%{_mandir}/man1/xznew.1
|
||||
%if %{with static}
|
||||
install -Dpm 0644 liblzma.a %{buildroot}%{_libdir}/
|
||||
%endif
|
||||
rm -vf %{buildroot}%{_docdir}/%{name}/{COPYING,COPYING.GPLv2}
|
||||
|
||||
%post -n liblzma5 -p /sbin/ldconfig
|
||||
%postun -n liblzma5 -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%license COPYING COPYING.GPLv2
|
||||
%{_docdir}/%{name}
|
||||
%{_bindir}/lzcat
|
||||
%{_bindir}/lzcmp
|
||||
%{_bindir}/lzdiff
|
||||
%{_bindir}/lzegrep
|
||||
%{_bindir}/lzfgrep
|
||||
%{_bindir}/lzgrep
|
||||
%{_bindir}/lzless
|
||||
%{_bindir}/lzma
|
||||
%{_bindir}/lzmadec
|
||||
%{_bindir}/lzmainfo
|
||||
%{_bindir}/lzmore
|
||||
%{_bindir}/unlzma
|
||||
%{_bindir}/unxz
|
||||
%{_bindir}/xz
|
||||
%{_bindir}/xzcat
|
||||
%{_bindir}/xzcmp
|
||||
%{_bindir}/xzdec
|
||||
%{_bindir}/xzdiff
|
||||
%{_bindir}/xzegrep
|
||||
%{_bindir}/xzfgrep
|
||||
%{_bindir}/xzgrep
|
||||
%{_bindir}/xzless
|
||||
%{_bindir}/xzmore
|
||||
%{_bindir}/xznew
|
||||
%{_mandir}/man1/lzcat.1%{?ext_man}
|
||||
%{_mandir}/man1/lzcmp.1%{?ext_man}
|
||||
%{_mandir}/man1/lzdiff.1%{?ext_man}
|
||||
%{_mandir}/man1/lzegrep.1%{?ext_man}
|
||||
%{_mandir}/man1/lzfgrep.1%{?ext_man}
|
||||
%{_mandir}/man1/lzgrep.1%{?ext_man}
|
||||
%{_mandir}/man1/lzless.1%{?ext_man}
|
||||
%{_mandir}/man1/lzma.1%{?ext_man}
|
||||
%{_mandir}/man1/lzmadec.1%{?ext_man}
|
||||
%{_mandir}/man1/lzmainfo.1%{?ext_man}
|
||||
%{_mandir}/man1/lzmore.1%{?ext_man}
|
||||
%{_mandir}/man1/unlzma.1%{?ext_man}
|
||||
%{_mandir}/man1/unxz.1%{?ext_man}
|
||||
%{_mandir}/man1/xz.1%{?ext_man}
|
||||
%{_mandir}/man1/xzcat.1%{?ext_man}
|
||||
%{_mandir}/man1/xzcmp.1%{?ext_man}
|
||||
%{_mandir}/man1/xzdec.1%{?ext_man}
|
||||
%{_mandir}/man1/xzdiff.1%{?ext_man}
|
||||
%{_mandir}/man1/xzegrep.1%{?ext_man}
|
||||
%{_mandir}/man1/xzfgrep.1%{?ext_man}
|
||||
%{_mandir}/man1/xzgrep.1%{?ext_man}
|
||||
%{_mandir}/man1/xzless.1%{?ext_man}
|
||||
%{_mandir}/man1/xzmore.1%{?ext_man}
|
||||
%{_mandir}/man1/xznew.1%{?ext_man}
|
||||
|
||||
%files lang -f %{name}.lang
|
||||
%dir %{_mandir}/fr
|
||||
%dir %{_mandir}/de
|
||||
%dir %{_mandir}/ko
|
||||
%if 0%{?suse_version} == 1500
|
||||
%dir %{_mandir}/ro
|
||||
%dir %{_mandir}/uk
|
||||
%endif
|
||||
|
||||
%files -n liblzma5
|
||||
%{_libdir}/liblzma.so.5*
|
||||
|
||||
%files devel
|
||||
%{_includedir}/lzma.h
|
||||
%dir %{_includedir}/lzma/
|
||||
%{_includedir}/lzma/*
|
||||
%{_libdir}/liblzma.so
|
||||
%{_libdir}/pkgconfig/liblzma.pc
|
||||
|
||||
%if %{with static}
|
||||
%files static-devel
|
||||
%defattr(-, root, root)
|
||||
%{_libdir}/liblzma.a
|
||||
%endif
|
||||
|
||||
%changelog
|
177
xznew
Normal file
177
xznew
Normal file
@ -0,0 +1,177 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2015 Hans-Peter Jansen
|
||||
# Copyright (C) 1998, 2002, 2004 Free Software Foundation
|
||||
# Copyright (C) 1993 Jean-loup Gailly
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
check=0
|
||||
pipe=0
|
||||
opt=
|
||||
files=
|
||||
keep=0
|
||||
res=0
|
||||
old=0
|
||||
new=0
|
||||
block=1024
|
||||
# block is the disk block size (best guess, need not be exact)
|
||||
|
||||
warn="(does not preserve modes and timestamp)"
|
||||
tmp=`mktemp -d ${TMPDIR-/tmp}/zfoo.XXXXXX` || {
|
||||
echo 'cannot create temporary directory' >&2
|
||||
exit 1
|
||||
}
|
||||
trap "rm -rf $tmp/" 0 1 2 3 6 13 15
|
||||
set -C
|
||||
echo hi > $tmp/1
|
||||
echo hi > $tmp/2
|
||||
if test -z "`(${CPMOD-cpmod} $tmp/1 $tmp/2) 2>&1`"; then
|
||||
cpmod=${CPMOD-cpmod}
|
||||
warn=""
|
||||
fi
|
||||
|
||||
if test -z "$cpmod" && ${TOUCH-touch} -r $tmp/1 $tmp/2 2>/dev/null; then
|
||||
cpmod="${TOUCH-touch}"
|
||||
cpmodarg="-r"
|
||||
warn="(does not preserve file modes)"
|
||||
fi
|
||||
|
||||
# check about xz extension
|
||||
xz $tmp/1 > /dev/null 2>&1
|
||||
ext=`echo $tmp/1* | sed "s|$tmp/1||"`
|
||||
rm -rf $tmp/
|
||||
trap - 0 1 2 3 6 13 15
|
||||
if test -z "$ext"; then
|
||||
echo xznew: error determining xz extension
|
||||
exit 1
|
||||
fi
|
||||
if test "$ext" = ".gz"; then
|
||||
echo xznew: cannot use .gz as xz extension.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-*) opt="$opt $arg"; shift;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "recompress .gz or .tgz files into $ext (xz) files"
|
||||
echo usage: `echo $0 | sed 's,^.*/,,'` "[-tv9KP]" file.gz...
|
||||
echo " -t tests the new files before deleting originals"
|
||||
echo " -v be verbose"
|
||||
echo " -9 use the slowest compression method (optimal compression)"
|
||||
echo " -K keep a .gz file when it is smaller than the $ext file"
|
||||
echo " -P use pipes for the conversion $warn"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
opt=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
||||
case "$opt" in
|
||||
*t*) check=1; opt=`echo "$opt" | sed 's/t//g'`
|
||||
esac
|
||||
case "$opt" in
|
||||
*K*) keep=1; opt=`echo "$opt" | sed 's/K//g'`
|
||||
esac
|
||||
case "$opt" in
|
||||
*P*) pipe=1; opt=`echo "$opt" | sed 's/P//g'`
|
||||
esac
|
||||
if test -n "$opt"; then
|
||||
opt="-$opt"
|
||||
fi
|
||||
|
||||
for i do
|
||||
m=`echo $i | sed 's/\.tgz$//'`
|
||||
if test -f "$m.tgz" ; then
|
||||
echo "Renaming file *.tgz to *.tar.gz"
|
||||
mv "$i" "$m.tar.gz"
|
||||
n=`echo $i | sed 's/\.tgz$/\.tar/'`
|
||||
else
|
||||
n=`echo $i | sed 's/\.gz$//'`
|
||||
fi
|
||||
if test ! -f "$n.gz" ; then
|
||||
echo $n.gz not found
|
||||
res=1; continue
|
||||
fi
|
||||
test $keep -eq 1 && old=`wc -c < "$n.gz"`
|
||||
if test $pipe -eq 1; then
|
||||
if gzip -d < "$n.gz" | xz $opt > "$n$ext"; then
|
||||
# Copy file attributes from old file to new one, if possible.
|
||||
test -n "$cpmod" && $cpmod $cpmodarg "$n.gz" "$n$ext" 2> /dev/null
|
||||
else
|
||||
echo error while recompressing $n.gz
|
||||
res=1; continue
|
||||
fi
|
||||
else
|
||||
if test $check -eq 1; then
|
||||
if cp -p "$n.gz" "$n.$$" 2> /dev/null || cp "$n.gz" "$n.$$"; then
|
||||
:
|
||||
else
|
||||
echo cannot backup "$n.gz"
|
||||
res=1; continue
|
||||
fi
|
||||
fi
|
||||
if gzip -d "$n.gz"; then
|
||||
:
|
||||
else
|
||||
test $check -eq 1 && mv "$n.$$" "$n.gz"
|
||||
echo error while uncompressing $n.gz
|
||||
res=1; continue
|
||||
fi
|
||||
if xz $opt "$n"; then
|
||||
:
|
||||
else
|
||||
if test $check -eq 1; then
|
||||
mv "$n.$$" "$n.gz" && rm -f "$n"
|
||||
echo error while recompressing $n
|
||||
else
|
||||
# gzip $n (might be dangerous if disk full)
|
||||
echo error while recompressing $n, left uncompressed
|
||||
fi
|
||||
res=1; continue
|
||||
fi
|
||||
fi
|
||||
test $keep -eq 1 && new=`wc -c < "$n$ext"`
|
||||
if test $keep -eq 1 && test `expr \( $old + $block - 1 \) / $block` -lt \
|
||||
`expr \( $new + $block - 1 \) / $block`; then
|
||||
if test $pipe -eq 1; then
|
||||
rm -f "$n$ext"
|
||||
elif test $check -eq 1; then
|
||||
mv "$n.$$" "$n.gz" && rm -f "$n$ext"
|
||||
else
|
||||
xz -d "$n$ext" && gzip "$n" && rm -f "$n$ext"
|
||||
fi
|
||||
echo "$n.gz smaller than $n$ext -- unchanged"
|
||||
|
||||
elif test $check -eq 1; then
|
||||
if xz -t "$n$ext" ; then
|
||||
rm -f "$n.$$" "$n.gz"
|
||||
else
|
||||
test $pipe -eq 0 && mv "$n.$$" "$n.gz"
|
||||
rm -f "$n$ext"
|
||||
echo error while testing $n$ext, $n.gz unchanged
|
||||
res=1; continue
|
||||
fi
|
||||
elif test $pipe -eq 1; then
|
||||
rm -f "$n.gz"
|
||||
fi
|
||||
done
|
||||
exit $res
|
39
xznew.1
Normal file
39
xznew.1
Normal file
@ -0,0 +1,39 @@
|
||||
.TH XZNEW 1
|
||||
.SH NAME
|
||||
xznew \- recompress .gz or .tgz files to .xz files
|
||||
.SH SYNOPSIS
|
||||
.B xznew
|
||||
[ -ftv9PK] [ name.gz ... ]
|
||||
.SH DESCRIPTION
|
||||
.I xznew
|
||||
recompresses files from .gz (gzip) format to .xz (xz) format.
|
||||
If you want to recompress a file already in xz format, rename the file
|
||||
to force a .xz extension then apply xznew.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-f
|
||||
Force recompression from .gz to .xz format even if a .xz file already exists.
|
||||
.TP
|
||||
.B \-t
|
||||
Tests the new files before deleting originals.
|
||||
.TP
|
||||
.B \-v
|
||||
Verbose. Display the name and percentage reduction for each file compressed.
|
||||
.TP
|
||||
.B \-9
|
||||
Use the slowest compression method (optimal compression).
|
||||
.TP
|
||||
.B \-P
|
||||
Use pipes for the conversion to reduce disk space usage.
|
||||
.TP
|
||||
.B \-K
|
||||
Keep a .gz file when it is smaller than the .xz file
|
||||
.SH "SEE ALSO"
|
||||
xz(1), gzip(1)
|
||||
.SH BUGS
|
||||
.I xznew
|
||||
does not maintain the time stamp with the -P option if
|
||||
.I cpmod(1)
|
||||
is not available and
|
||||
.I touch(1)
|
||||
does not support the -r option.
|
Loading…
Reference in New Issue
Block a user