delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/09/15/13:48:26

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 48FHmPZK609500
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=eLTP9GsO
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6995385841E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1726422503;
bh=L7qcBgOFH+F5Xjubx3UkMV6zOd4Kv/6Dh4KD+EAtuxM=;
h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=eLTP9GsOIcSM9kdwmZqHwuVhk61Jii3YoiYfql3mqbqtugWdtMMjF7HWipjVn8CIZ
kPvP+1jftOscTOrPddWovWI1GKCbt1YCutVa8DMrYmCOUNrGcaVlyir2med97lH6RE
MuzM0mNva4fY54QLMGouoVru+kDs5WisyMsrMO+Q=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 584E23858D20
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 584E23858D20
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726422450; cv=none;
b=qKGfNuSFFi1D3HVsqzj7mXcZA8BYAot/iUsPedWh8+udaiSOXQ5K3KiVhUurIAanAQIDVnpnY217SvZDSFgXN35IQuw00kkwP5H/r0Bz0M4SegPG3FTnXfk6i5uCDxg1Vb0oJFUg3vUdfaPGPDhvvTgyATgQeOOBGiKvcxtZ1B8=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1726422450; c=relaxed/simple;
bh=erirbDCWUgWV2t8IckIIuidZIIIvp6ngbm8y9/AVhUk=;
h=From:Subject:To:Message-ID:Date:MIME-Version;
b=G1vjtBeSbwx1yUha17g8aHfTawBv63KIRCawvDqjuQXLRBrmKjibcWzN2i8mFb/GX4Fc9pJ+GuvASaYBtt/G20aSE3FR/nCJ19B5fyyR65lJXcUjwtp6QmIT1qp9MzbCjhiOanTPhWh21aSOPZEy93cM6gTPMiuShan28Yy/Pmk=
ARC-Authentication-Results: i=1; server2.sourceware.org
Subject: readdir() returns inaccessible name if file was created with invalid
UTF-8
To: cygwin AT cygwin DOT com
Message-ID: <96f2253b-791b-b8a0-97dd-8d257eefb9b1@t-online.de>
Date: Sun, 15 Sep 2024 19:47:11 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
SeaMonkey/2.53.18.2
MIME-Version: 1.0
X-TOI-EXPURGATEID: 150726::1726422432-697F84AB-23C9B85D/0/0 CLEAN NORMAL
X-TOI-MSGID: 8dd5b8ce-5dd2-4f2c-85a9-cdc75c9f54e1
X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM,
KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,
RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Christian Franke via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Christian Franke <Christian DOT Franke AT t-online DOT de>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 48FHmPZK609500

If a file name contains an invalid (truncated) UTF-8 sequence, open() 
does not refuse to create the file. Later readdir() returns a different 
name which could not be used to access the file.

Testcase with U+1F321 (Thermometer):

$ uname -r
3.5.4-1.x86_64

$ printf $'\U0001F321' | od -A none -t x1
  f0 9f 8c a1

$ touch 'file1-'$'\xf0\x9f\x8c\xa1''.ext'

$ touch 'file2-'$'\xf0\x9f\x8c''.ext'

$ touch 'file3-'$'\xf0\x9f\x8c'

$ ls -1
ls: cannot access 'file2-.?ext': No such file or directory
ls: cannot access 'file3-': No such file or directory
'file1-'$'\360\237\214\241''.ext'
file2-.?ext
file3-


Name mapping according to "fhandler_disk_file::readdir" strace lines:

"file1-\xF0\x9F\x8C\xA1.ext" -(open)-> L"file1-\xD83C\xDF21.ext" 
-(readdir)->
"file1-\xF0\x9F\x8C\xA1.ext"

"file2-\xF0\x9f\x8C.ext" -(open)-> L"file2-\xD83C\xF02Eext" -(readdir)->
"file2-.\xE1\x9E\xB3ext"

"file3-\xF0\x9F\x8C" -(open)-> L"file3-\xD83C\xF000" -(readdir)->
"file3-"

Issue found because 'stress-ng --filename ...' could not cleanup its 
temp directory.

-- 
Regards,
Christian


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019