Bug#1024974: [libc6] Schroedinger's fnmatch() in an UTF-8 locale

2022-11-27 Thread Peter Pentchev
Package: libc6
Version: 2.36-5
Severity: normal
Tags: upstream
X-Debbugs-Cc: r...@debian.org

Hi,

Thanks for taking care of glibc in Debian!

While trying to write a test case for a text processing utility that is
sort of aware of locales and character encodings, I stumbled upon
the fact that, in an UTF-8-capable locale, fnmatch() seems to think
that the `ñ` ("enye", "LATIN SMALL LETTER N WITH TILDE", U+00F1)
character should match both the "?" and "??" patterns. See the attached
C program and the `run-test.sh` demonstration tool; `make test` in
a directory where all four files are installed should do it.
If anything goes wrong with the attached files, they are also available
in a GitLab repository at https://gitlab.com/ppentchev/fnmess

A bullseye chroot and Docker container do not show the problem
(the test passes).

FTR, I was able to reproduce the problem on an AlmaLinux 9 system with
glibc 2.34, so it might not be limited to 2.36.

Thanks in advance for your time, and keep up the great work!

G'luck,
Peter


-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'oldstable-updates'), (500, 'oldoldstable'), (500, 
'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0-4-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libc6 depends on:
ii  libgcc-s1  12.2.0-9

Versions of packages libc6 recommends:
ii  libidn2-0  2.3.3-1+b1

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]  1.5.79
pn  glibc-doc  
ii  libc-l10n  2.36-5
pn  libnss-nis 
pn  libnss-nisplus 
ii  locales2.36-5

-- debconf information:
* libraries/restart-without-asking: true
  glibc/disable-screensaver:
  glibc/kernel-not-supported:
  glibc/kernel-too-old:
  glibc/restart-failed:
  glibc/restart-services:
  glibc/upgrade: true
#!/usr/bin/make -f
#
# Copyright (c) 2022  Peter Pentchev 
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#notice, this list of conditions and the following disclaimer in the
#documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

CPPFLAGS?=  -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700

CFLAGS_WARN?=   -Wall -W -Wextra -Wno-trigraphs
CFLAGS_OPT?=-g -O -pipe

CFLAGS?=${CFLAGS_WARN} ${CFLAGS_OPT}

LDFLAGS?=

LIBS?=

all:fnmess

fnmess: fnmess.o
cc ${LDFLAGS} -o fnmess fnmess.o ${LIBS}

fnmess.o:   fnmess.c
cc -c ${CPPFLAGS} ${CFLAGS} -o fnmess.o fnmess.c

clean:
rm -f fnmess fnmess.o

test:   all
sh run-test.sh python3 fnmess.py
sh run-test.sh ./fnmess

.PHONY: clean all test
/**
 * Copyright (c) 2022  Peter Pentchev 
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 

Bug#1024940: glibc: declare packages skipped by noudeb build profile

2022-11-27 Thread Helmut Grohne
Source: glibc
Version: 2.36-5
Severity: minor
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

Hi Aurelien et al,

I noticed that while glibc does implement the noudeb build profile
somewhat, it does not declare the profile in debian/control. I'm
attaching a patch to fix that latter part for your convenience.

Helmut
diff --minimal -Nru glibc-2.36/debian/changelog glibc-2.36/debian/changelog
--- glibc-2.36/debian/changelog 2022-11-12 14:23:05.0 +0100
+++ glibc-2.36/debian/changelog 2022-11-27 14:47:44.0 +0100
@@ -1,3 +1,10 @@
+glibc (2.36-5.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Declare packages skipped by noudeb build profile. (Closes: #-1)
+
+ -- Helmut Grohne   Sun, 27 Nov 2022 14:47:44 +0100
+
 glibc (2.36-5) unstable; urgency=medium
 
   [ Samuel Thibault ]
diff --minimal -Nru glibc-2.36/debian/control glibc-2.36/debian/control
--- glibc-2.36/debian/control   2022-11-09 23:31:15.0 +0100
+++ glibc-2.36/debian/control   2022-11-27 14:45:51.0 +0100
@@ -222,7 +222,7 @@
 Section: debian-installer
 Priority: optional
 Provides: libc6, libc-udeb, libnss-dns-udeb, libnss-files-udeb
-Build-Profiles: 
+Build-Profiles: 
 Description: GNU C Library: Shared libraries - udeb
  Contains the standard libraries that are used by nearly all programs on
  the system. This package includes shared versions of the standard C library
@@ -296,7 +296,7 @@
 Section: debian-installer
 Priority: optional
 Provides: libc6.1, libc-udeb, libnss-dns-udeb, libnss-files-udeb
-Build-Profiles: 
+Build-Profiles: 
 Description: GNU C Library: Shared libraries - udeb
  Contains the standard libraries that are used by nearly all programs on
  the system. This package includes shared versions of the standard C library
@@ -370,7 +370,7 @@
 Section: debian-installer
 Priority: optional
 Provides: libc0.3, libc-udeb, libnss-dns-udeb, libnss-files-udeb
-Build-Profiles: 
+Build-Profiles: 
 Description: GNU C Library: Shared libraries - udeb
  Contains the standard libraries that are used by nearly all programs on
  the system. This package includes shared versions of the standard C library
@@ -444,7 +444,7 @@
 Section: debian-installer
 Priority: optional
 Provides: libc0.1, libc-udeb, libnss-dns-udeb, libnss-files-udeb
-Build-Profiles: 
+Build-Profiles: 
 Description: GNU C Library: Shared libraries - udeb
  Contains the standard libraries that are used by nearly all programs on
  the system. This package includes shared versions of the standard C library
diff --minimal -Nru glibc-2.36/debian/control.in/libc 
glibc-2.36/debian/control.in/libc
--- glibc-2.36/debian/control.in/libc   2022-11-09 23:31:03.0 +0100
+++ glibc-2.36/debian/control.in/libc   2022-11-27 14:46:08.0 +0100
@@ -63,7 +63,7 @@
 Section: debian-installer
 Priority: optional
 Provides: @libc@, libc-udeb, libnss-dns-udeb, libnss-files-udeb
-Build-Profiles: 
+Build-Profiles: 
 Description: GNU C Library: Shared libraries - udeb
  Contains the standard libraries that are used by nearly all programs on
  the system. This package includes shared versions of the standard C library