X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=07ifocVlhdxAI8MIj5zLIK3TE9qyeq9laDk9VJLg3nQ=; b=adeb8lswXjaTzwub7pXAAbQEP0/MYu1LbanbAFVINNDdl7/PpCmCK1SZeeuolFcgG8 ct7Cs89DwKyFRJBlTdbx/+XGAtr1GVr29Es25a6amSlcDWOtEQ7bm0FQRfIuHN6fBfXU xH6+1955uiBXCSrCcLesmwHi/+yJxd9sfptpBRJ+YgT/1aSocdpE4V5boAw4CIID6rTx rYSu1QIR/FqE8LYqBcBOxBe2sOmfDnnHOHLO4lh8zAHUMcrNj9Drr7qI/75pZeEKiaIB Ku82MiXRgoiNxybVK8Cqq4KgX/3RJg1ySc4VR/lqTMJUTvi6zNO711ohCBfB7sbt2lJN vvXQ== MIME-Version: 1.0 In-Reply-To: <201207130044.q6D0iXDf015563@envy.delorie.com> References: <201207130044 DOT q6D0iXDf015563 AT envy DOT delorie DOT com> Date: Fri, 13 Jul 2012 00:15:56 -0500 Message-ID: Subject: Re: mktemp() fails on "detmp.xxx" but not "detmp.XXX" (proposed patch) From: Rugxulo To: djgpp-workers AT delorie DOT com Content-Type: text/plain; charset=ISO-8859-1 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Hi, On Thu, Jul 12, 2012 at 7:44 PM, DJ Delorie wrote: > > CONFORMING TO > 4.3BSD, POSIX.1-2001. POSIX.1-2008 removes the specification > of mktemp(). Interesting, typical, funny, annoying that 2008 removes it, heh. Actually, Emacs' callproc.c uses mkstemp(), which for DJGPP actually calls mktemp() itself. > My POSIX spec is older than 2001 so I can't confirm this. Note that > the XXXXXX part is *not* a filename component, but a pattern to be > replaced, so the "files are case ignoring" argument doesn't apply. I'm not understanding you. Or maybe you misunderstood me, dunno. Yes, I know it's a template, and I've recompiled mktemp.c with -DTEST several ways. My point is that mktemp() fails when Emacs "accidentally" (in SFN 8.3 situations only) lowercase'd the template, hence "detmp.xxx" [sic] fails where "detmp.XXX" would succeed. Since DOS' file system (FAT) is case insensitive anyways, it seems silly (to me) for mktemp() to fail this call just because the 'x' chars aren't uppercase. Lemme get on my other computer for a clearer example: (runs to other room) [ FreeDOS ] G:\TONY>gcc -x c -s -O -DTEST -DTOUPPER=toupper mktemp.new -o b [ FreeDOS ] G:\TONY>gcc -x c -s -O -DTEST mktemp.new -o a [ FreeDOS ] G:\TONY>a /usr/foo/detmp.XXX -> /usr/foo/deaaaaaa /usr/foo/detmp.xxx -> [ FreeDOS ] G:\TONY>b /usr/foo/detmp.XXX -> /usr/foo/deaaaaaa /usr/foo/detmp.xxx -> /usr/foo/debaaaaa [ FreeDOS ] G:\TONY>scrndump c:\tmp\emacs\mktemp.bug See what I mean? It rejects the template with lowercase 'x'. I know POSIX is more concerned with case sensitivity than we are, but I don't think it's any advantage to be this picky on FAT (DOS, SFN 8.3). It just makes hidden bugs harder to find. And it's an easy fix, but I guess it's your call.