Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

16 changed files with 337 additions and 108 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

7
.gitignore vendored
View File

@ -1 +1,6 @@
SOURCES/libunistring-0.9.9.tar.xz
libunistring-0.9.3.tar.gz
/libunistring-0.9.4.tar.xz
/libunistring-0.9.7.tar.xz
/libunistring-0.9.8.tar.xz
/libunistring-0.9.9.tar.xz
/libunistring-0.9.10.tar.xz

View File

@ -1 +0,0 @@
0f7049cf9cdea9d010235cf6c56254693da17eaa SOURCES/libunistring-0.9.9.tar.xz

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# libunistring
This project conatains libunistring i18n testcases

View File

@ -1,75 +0,0 @@
diff -ru libunistring-0.9.9.orig/lib/fseterr.c libunistring-0.9.9/lib/fseterr.c
--- libunistring-0.9.9.orig/lib/fseterr.c 2018-02-28 17:07:03.000000000 +0100
+++ libunistring-0.9.9/lib/fseterr.c 2018-08-15 16:40:53.419266090 +0200
@@ -1,20 +1,11 @@
/* Set the error indicator of a stream.
Copyright (C) 2007-2018 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or
- modify it under the terms of either:
+ 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 3 of the License, or
+ (at your option) any later version.
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- or
-
- * 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.
-
- or both in parallel, as here.
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
@@ -32,13 +23,17 @@
#include "stdio-impl.h"
+/* This file is not used on systems that have the __fseterr function,
+ namely musl libc. */
+
void
fseterr (FILE *fp)
{
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+ /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags |= _IO_ERR_SEEN;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
diff -ru libunistring-0.9.9.orig/lib/fseterr.h libunistring-0.9.9/lib/fseterr.h
--- libunistring-0.9.9.orig/lib/fseterr.h 2018-02-28 17:07:03.000000000 +0100
+++ libunistring-0.9.9/lib/fseterr.h 2018-08-15 16:40:53.419266090 +0200
@@ -1,20 +1,11 @@
/* Set the error indicator of a stream.
Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or
- modify it under the terms of either:
+ 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 3 of the License, or
+ (at your option) any later version.
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- or
-
- * 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.
-
- or both in parallel, as here.
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

View File

@ -0,0 +1,85 @@
diff -ru libunistring-0.9.10/lib/vasnprintf.c libunistring-0.9.10.new/lib/vasnprintf.c
--- libunistring-0.9.10/lib/vasnprintf.c 2018-05-25 18:02:16.000000000 +0200
+++ libunistring-0.9.10.new/lib/vasnprintf.c 2021-06-14 17:06:43.084948649 +0200
@@ -1864,7 +1864,7 @@
/* Ensures that allocated >= needed. Aborts through a jump to
out_of_memory if needed is SIZE_MAX or otherwise too big. */
-#define ENSURE_ALLOCATION(needed) \
+#define ENSURE_ALLOCATION_ELSE(needed, oom_statement) \
if ((needed) > allocated) \
{ \
size_t memory_size; \
@@ -1875,17 +1875,19 @@
allocated = (needed); \
memory_size = xtimes (allocated, sizeof (DCHAR_T)); \
if (size_overflow_p (memory_size)) \
- goto out_of_memory; \
+ oom_statement \
if (result == resultbuf || result == NULL) \
memory = (DCHAR_T *) malloc (memory_size); \
else \
memory = (DCHAR_T *) realloc (result, memory_size); \
if (memory == NULL) \
- goto out_of_memory; \
+ oom_statement \
if (result == resultbuf && length > 0) \
DCHAR_CPY (memory, result, length); \
result = memory; \
}
+#define ENSURE_ALLOCATION(needed) \
+ ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; )
for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
{
@@ -2137,7 +2139,8 @@
}
if (converted != result + length)
{
- ENSURE_ALLOCATION (xsum (length, converted_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted, converted_len);
free (converted);
}
@@ -2263,7 +2266,8 @@
}
if (converted != result + length)
{
- ENSURE_ALLOCATION (xsum (length, converted_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted, converted_len);
free (converted);
}
@@ -2389,7 +2393,8 @@
}
if (converted != result + length)
{
- ENSURE_ALLOCATION (xsum (length, converted_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted, converted_len);
free (converted);
}
@@ -2914,7 +2919,8 @@
}
}
# else
- ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
length += tmpdst_len;
@@ -5368,7 +5374,8 @@
errno = saved_errno;
return NULL;
}
- ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
count = tmpdst_len;
libunistring-0.9.10.new/lib のみに存在: vasnprintf.c.orig

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,15 +1,14 @@
# This spec file has been automatically updated
Version: 0.9.9
Release: 3%{?dist}
Version: 0.9.10
Release: 15%{?dist}
Name: libunistring
Group: System Environment/Libraries
Summary: GNU Unicode string library
License: GPLv2+ or LGPLv3+
Url: http://www.gnu.org/software/libunistring/
Source0: http://ftp.gnu.org/gnu/libunistring/%{name}-%{version}.tar.xz
Patch0: fseterr-update-20180815.patch
Requires(post): info
Requires(preun): info
URL: https://www.gnu.org/software/libunistring/
Source0: https://ftp.gnu.org/gnu/libunistring/%{name}-%{version}.tar.xz
Patch0: fix-memory-leak-in-vasnprintf.patch
BuildRequires: gcc
BuildRequires: make
Provides: bundled(gnulib)
%description
@ -20,36 +19,33 @@ This portable C library implements Unicode string types in three flavours:
case folding and regular expressions).
%package devel
Group: Development/Libraries
Summary: GNU Unicode string library - development files
Requires: %{name} = %{version}-%{release}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development files for programs using libunistring.
%prep
%setup -q
%patch0 -p1 -b .fseterr-update
%patch0 -p1 -b .fix-memory-leak-in-vasnprintf
%build
%configure --disable-static --disable-rpath
make %{?_smp_mflags}
%make_build
%install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
rm -f $RPM_BUILD_ROOT/%{_infodir}/dir
rm -f $RPM_BUILD_ROOT/%{_libdir}/%{name}.la
%make_install
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}.la
# Move staged docs so not picked up by %%doc in main package
mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name} __doc
%files
%defattr(-,root,root,-)
%license COPYING COPYING.LIB
%doc AUTHORS NEWS README
%{_libdir}/%{name}.so.*
%files devel
%defattr(-,root,root,-)
%doc HACKING DEPENDENCIES THANKS ChangeLog
%doc __doc/*
%{_infodir}/%{name}.info*
@ -59,22 +55,54 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name} __doc
%ldconfig_scriptlets
%post devel
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
%preun devel
if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi
%changelog
* Fri Aug 17 2018 Mike FABIAN <mfabian@redhat.com> - 0.9.9-3
- Fix invalid license tag
- Resolves: rhbz#1611728
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.9.10-15
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Aug 15 2018 Mike FABIAN <mfabian@redhat.com> - 0.9.9-2
- update fseterr from current gnulib to make it build on RHEL-8
- Resolves: rhbz#1611728
* Mon Jun 21 2021 Mike FABIAN <mfabian@redhat.com> - 0.9.10-14
- Related rhbz#1938800: Fix CI tests and convert them to tmt
* Mon Jun 14 2021 Mike FABIAN <mfabian@redhat.com> - 0.9.10-13
- Related rhbz#1938800: Fix spelling in license GPLV2+ -> GPLv2+
* Mon Jun 14 2021 Mike FABIAN <mfabian@redhat.com> - 0.9.10-12
- Fix memory leak in vasnprint. Resolves: rhbz#1938800
(Backported from upstream: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4d288a80bf7ebe29334b9805cdcc70eacb6059c1)
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.9.10-11
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.10-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.10-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 0.9.10-8
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.10-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.10-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.10-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Jul 31 2018 Florian Weimer <fweimer@redhat.com> - 0.9.10-4
- Rebuild with fixed binutils
* Sat Jul 28 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.9.10-3
- Replace obsolete scriptlets
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon May 28 2018 Daiki Ueno <dueno@redhat.com> - 0.9.10-1
- Update to upstream 0.9.10 release
* Thu Mar 01 2018 Daiki Ueno <dueno@redhat.com> - 0.9.9-1
- Update to upstream 0.9.9 release

5
plans/basic.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (libunistring-0.9.10.tar.xz) = 01dcab6e05ea4c33572bf96cc0558bcffbfc0e62fc86410cef06c1597a0073d5750525fe2dee4fdb39c9bd704557fcbab864f9645958108a2e07950bc539fe54

3
tests/README.md Normal file
View File

@ -0,0 +1,3 @@
# libunistring
This project conatains libunistring i18n testcases

2
tests/libunistring-tests/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
test
testfile.utf*

View File

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
import sys
import os
import subprocess
import logging
"""
Creating a result.log file for saving logs
"""
logging.basicConfig(level=logging.INFO)
logging.info("TEST RESULTS FOR <uniconv.h> FUNCTION\n\n")
data = []
TESTTEXT = 'Viele Grüße\n日本語\n'
def create_testfiles():
dummy = subprocess.run("./test '" + TESTTEXT + "'", shell=True)
def test(path='', encoding=''):
"""
Read the file at path using the specified encoding and check
whether the TESTTEXT can be read back correctly.
"""
logging.info('Testing file %s using encoding %s', path, encoding)
try:
with open(path, mode='rt', encoding=encoding) as testfile:
text = testfile.read()
logging.info('TESTTEXT="%s", text read ="%s"\n', TESTTEXT, text)
if text == TESTTEXT:
logging.info(
'testfile: %s testencoding: %s Read test: SUCCESS',
path, encoding)
else:
logging.info(
'testfile: %s testencoding: %s Read test: ERROR',
path, encoding)
except UnicodeError:
logging.error("UTF-8 Conversion Test: UnicodeError")
if __name__ == "__main__":
if sys.byteorder == 'little':
endianness = 'le'
else:
endianness = 'be'
testfiles = {
'testfile.utf-8': 'utf-8',
'testfile.utf-16': 'utf-16' + endianness,
'testfile.utf-32': 'utf-32' + endianness,
}
for testfile in testfiles:
if os.path.isfile(testfile):
os.unlink(testfile)
create_testfiles()
for testfile in testfiles:
test(path=testfile, encoding=testfiles[testfile])

View File

@ -0,0 +1,16 @@
summary: Functional test for the gettext module
contact: Pooja Yadav <poyadav@redhat.com>
component:
- python
require:
- gcc
- make
- libunistring
- libunistring-devel
test: bash runtest.sh
framework: beakerlib
recommend:
- python
duration: 5m
extra-summary: /CoreOS/python/libunistring-tests
extra-task: /CoreOS/python/libunistring-tests

View File

@ -0,0 +1,54 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/python/libunistring-tests
# Description: Functional tests for libunistring to check i18n features.
# Author: Pooja Yadav <poyadav@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="libunistring"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "gcc test.c -lunistring -o test"
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "cp libunistring_test.py test $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlLog "Run libunistring_test.py"
rlRun "python libunistring_test.py"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,38 @@
#include <stdio.h>
#include <uniconv.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
int
main (int argc, char **argv)
{
if (argc < 2) {
printf ("Usage: %s <a string>\n", argv[0]);
return 1;
}
size_t len8, len16, len32;
uint8_t *res8 = u8_conv_from_encoding ("UTF-8", iconveh_question_mark, argv[1], strlen (argv[1]), NULL, NULL, &len8);
uint16_t *res16 = u16_conv_from_encoding ("UTF-8", iconveh_question_mark, argv[1], strlen (argv[1]), NULL, NULL, &len16);
uint32_t *res32 = u32_conv_from_encoding ("UTF-8", iconveh_question_mark, argv[1], strlen (argv[1]), NULL, NULL, &len32);
int fd = open ("testfile.utf-8", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
for (int i = 0; i < len8; i++)
write (fd, &res8[i], sizeof (uint8_t));
close (fd);
fd = open ("testfile.utf-16", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
for (int i = 0; i < len16; i++)
write (fd, &res16[i], sizeof (uint16_t));
close (fd);
fd = open ("testfile.utf-32", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
for (int i = 0; i < len32; i++)
write (fd, &res32[i], sizeof (uint32_t));
close (fd);
}