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

FC Stegerman flx at obfusk.net
Mon Feb 20 17:58:10 UTC 2023


> > >> 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.

But it does have (unintended) consequences; for example, diffoscope
[1] relies on file/libmagic to tell apart text and binary files.

Before this patch was accepted, it would have correctly identified --
and compared -- the RDP files as text files because the TextFile
comparator uses FILE_TYPE_RE = re.compile(r"\btext\b") to identify
those (in the absence of a more specific comparator).

But with the patch, it will fall back to a binary comparison, as file
no longer identifies it as a text file.

I consider this a regression in file, one that is easily fixed by
simply using string/t here.

Before:

$ diffoscope foo.rdp bar.rdp
--- foo.rdp
+++ bar.rdp
@@ -1 +1 @@
-screen mode id:i:1
+screen mode id:i:2

After:

$ diffoscope foo.rdp bar.rdp
--- foo.rdp
+++ bar.rdp
@@ -1,2 +1,2 @@
 00000000: 7363 7265 656e 206d 6f64 6520 6964 3a69  screen mode id:i
-00000010: 3a31 0a                                  :1.
+00000010: 3a32 0a                                  :2.

- FC

[1] https://diffoscope.org/


More information about the File mailing list