Re: Correct handling of blank/commented lines in PSQL interactive-mode history

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Nancarrow <gregn4422(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Date: 2021-11-30 21:52:31
Message-ID: 20211130215231.GC3167@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 30, 2021 at 04:35:13PM -0500, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > On Mon, Nov 29, 2021 at 11:12:35PM -0500, Tom Lane wrote:
> >> Interesting. I can probably adjust my MUA to send "text/x-patch",
> >> but I'll have to look around to see where that's determined.
>
> > I would be interesting to know if "text/x-patch" is better than
> > "text/x-diff" --- I currently use the later.
>
> I found out that where that is coming from is "file -i", so I'm a
> bit loath to modify it. Is there any hard documentation as to why
> "text/x-patch" should be preferred?

I thought this was happening from /etc/mime.types:

text/x-diff diff patch

The file extensions 'diff' and 'patch' trigger mime to use text/x-diff
for its attachments, at least on Debian. Based on that, I assumed
"text/x-diff" was more standardized than "text/x-patch".

However, it seems file -i also looks at the contents since a file with a
single word in it is not recognized as a diff:

$ git diff > /rtmp/x.diff
$ file -i /rtmp/x.diff
/rtmp/x.diff: text/x-diff; charset=us-ascii
-----------
$ echo test > /rtmp/x.diff
$ file -i /rtmp/x.diff
/rtmp/x.diff: text/plain; charset=us-ascii
----------

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bossart, Nathan 2021-11-30 21:56:36 Re: Postgres restart in the middle of exclusive backup and the presence of backup_label file
Previous Message Tom Lane 2021-11-30 21:35:13 Re: Correct handling of blank/commented lines in PSQL interactive-mode history