[File] [PATCH] Magdir/windows for Remote Desktop Protocol connection *.rdp

FC Stegerman flx at obfusk.net
Sun Feb 19 20:39:27 UTC 2023


* Jörg Jenderek <joerg.jen.der.ek at gmx.net> [2023-02-19 19:55]:
> Am 19.02.2023 um 00:43 schrieb FC Stegerman:
> > * Jörg Jenderek <joerg.jen.der.ek at gmx.net> [2023-02-18 23:30]:
> >> Default-1.rdp: ASCII text, with CRLF line terminators
> >> Default.rdp:   ASCII text, with CRLF line terminators
> > [...]
> >>  0 string screen\040mode\040id:i: Remote Desktop Protocol connection
> >>  !:mime	text/x-ms-rdp
> >>  !:ext	rdp
> >>  >17	string	1			\b, window mode
> >>  >17	string	2			\b, full screen mode
> > [...]
> >> Default-1.rdp: Remote Desktop Protocol connection, full screen mode
> >> Default.rdp:   Remote Desktop Protocol connection, full screen mode
> >
> > Aren't these still text files?  Even the MIME type starts with text/.
> > But the string test is classified as binary, so file now recognises
> > them as binary instead of text.  Maybe use string/t to avoid that?
> >
> The test as binary works in any case so far as i can see.

Yes, it works.  It's probably also faster (from my experience writing
a magic entry for .smali files, which I also originally misidentified
as binary instead of text).  But IMO it's still wrong to use a binary
file test like string for a text file without specifying /t.
Especially since the MIME type clearly indicates this is a text file,
not binary.

> The problem is that there exist no complete specification especially
> from Microsoft itself. Even the current often used classification
> with mime type text/plain is not from Microsoft. The phrase "with
> CRLF" implies that such samples can be opened by editors for
> DOS/Windows.  Now comes the ugly part. On DOS many editors put a
> Control-Z character at the end of the file and such samples are
> considered by file command version 5.44 as binary. This unexpected
> Control-Z bug for example also occurs for some DOS batch files for
> which i am writing a patch.

That does complicate things.  But does it provide a reason not to add
the /t flag to use the string test as a text file test (as search or
regex would be by default) for what is clearly a text file?

- FC


More information about the File mailing list