Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyVV0-0001Xc-6Z for pgadmin-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 08:23:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyVUz-0005Rp-4b for pgadmin-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 08:23:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyVUy-0005Rh-Sn for pgadmin-hackers@lists.postgresql.org; Wed, 30 Jun 2021 08:23:08 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lyVUw-0000a0-74 for pgadmin-hackers@postgresql.org; Wed, 30 Jun 2021 08:23:08 +0000 Received: by mail-ej1-x632.google.com with SMTP id gn32so2843826ejc.2 for ; Wed, 30 Jun 2021 01:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vk/Qjt0yG/wTYi3ut7TgqhgXWElEo5qJTMxZxy4L4AA=; b=WzmdBZtIEG6cFcwybFjZ2Vh6KyMeff+LChG9eI7RssC15iD75Sdl4dX58kl64EF+AC 8V4iwvA76Ksd4J0zklDwsv1iYoQPl5zxDbOEghMVHw7MraNWEZj1EySMPWZMS1owgz8i GMbTpeNXDJBDti2iM8uLpJ9t916ZXW+oIpyp/mIpG1xLMHIkYfR/SCzP+V7RrssNQ7rg ATl8K19CzGO5H887O5BQruBwS7DoL1F8ZIuPPdz7TLVkmc4j9h9duoCBwixx8b1Y6Eys yRbmfupEpd5L8JHp9EwSh2q335YTO2CojPBYE7ff1Oyc4QiAFhWECKbXLXTjep1yzEhe +kiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vk/Qjt0yG/wTYi3ut7TgqhgXWElEo5qJTMxZxy4L4AA=; b=oyHUH6nmIcTPWqEM3f7/oRMHW9H3aza+OSbWRG2GJxRZZoIEBrNHrRtdO4e0cerU/w nrU0sGGqUJ8L4fNI4AMdeGgkk3u2QQrPHOvjTyqGACFJpedOor/qfpPw3pBdGzPa3bYk gd+0p2Tq9IRHol+ZPuaN1xTHNIT5FeRsJE4Q4UtP3zBVc5PrwDIm6LQmiufMILJEatSq KGyOPj1VZFFaiyD9nbD5ktmMSoyz5yo25lBlJwupYFSfp/PHdrAIWZILW0hPmfa1oiaD jRqYEKHRpkXpzIEhBWMeEe2W4HFY0Huqgx+RVyxxzjtFks20JsuDmtH2iCXCAiuhm9JP 0mRQ== X-Gm-Message-State: AOAM531NIJR5qlaLFrptQmFtdE8FJNEaj1B+abTNfc4+vu8TzsgKCYWv ghdq0g7CbdSudlOK5OAi5Z/w7evQcGe94brVkM0HcQ== X-Google-Smtp-Source: ABdhPJw3foRy/pgCF15QHBwnhAcxi7gz3g2ZeQGF23uV/hlhv1/VPW5bhCUq9KfSVX2ZrttLGqUr8WuM0D59rKNLObs= X-Received: by 2002:a17:907:3e0b:: with SMTP id hp11mr34149313ejc.89.1625041384820; Wed, 30 Jun 2021 01:23:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Page Date: Wed, 30 Jun 2021 09:22:53 +0100 Message-ID: Subject: Re: [patch][pgAdmin] Fix for pgadmin4-linux-qa #1651 failure To: Rahul Shirsat Cc: Aditya Toshniwal , pgadmin-hackers Content-Type: multipart/alternative; boundary="0000000000007cf55105c5f76efb" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007cf55105c5f76efb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Wed, Jun 30, 2021 at 8:28 AM Rahul Shirsat < rahul.shirsat@enterprisedb.com> wrote: > Hi All, > > Please find the attached patch for resolving this issue wrt above > suggestion. > Well that may fix the problem (and is a reasonable change), however, I think it's important that we understand the root cause. Why is this failing on Linux only? Why does the following from node.js (which follows the same pattern) work fine? var type_label =3D gettext('%s Script',stype.toUpperCase()); > Let me know if anyone has any queries. > > On Tue, Jun 29, 2021 at 9:20 PM Rahul Shirsat < > rahul.shirsat@enterprisedb.com> wrote: > >> Hi Dave / Aditya, >> >> For a time being, Let's make a call to gettext conditional instead of >> passing dynamic parameters for this scenario at least. With this, we won= 't >> be touching the *.po files and translations will do its task smoothly. >> I have already checked for the string with weird unprintable characters, >> and there were none. >> >> e.g. >> Instead of - *title =3D gettext('%s objects?', obj.label);* >> >> *if (drop) {* >> * title =3D gettext('Drop objects?');* >> *}* >> *else {* >> *title =3D gettext('Reassign objects?');* >> *}* >> >> I have tried the above code and it looks good to me. >> >> Please suggest. >> >> On Tue, Jun 29, 2021 at 7:31 PM Dave Page wrote: >> >>> >>> >>> On Tue, Jun 29, 2021 at 2:55 PM Aditya Toshniwal < >>> aditya.toshniwal@enterprisedb.com> wrote: >>> >>>> Hi, >>>> >>>> On Tue, Jun 29, 2021 at 7:14 PM Dave Page wrote: >>>> >>>>> >>>>> >>>>> On Tue, Jun 29, 2021 at 2:41 PM Aditya Toshniwal < >>>>> aditya.toshniwal@enterprisedb.com> wrote: >>>>> >>>>>> Dave, >>>>>> >>>>>> Somehow, the new text strings are added to PO with incorrect >>>>>> translations. That is causing the issue. >>>>>> Either they should be empty or fixed. >>>>>> >>>>> >>>>> Then the source problem should be fixed. There's no point at all in >>>>> putting fixes directly in the PO files as they'll be overwritten prio= r to >>>>> release anyway. >>>>> >>>> The translations submitted by translators are updated in the PO file >>>> right ? And then they're compiled to MO ? >>>> >>> >>> Right. >>> >>> >>>> It's the same like Rahul will be submitting the translations. Please >>>> correct me if I'm wrong. >>>> >>> >>> That depends if he's changed the original message or the translated >>> message. It's impossible to see without reading megabytes of text. >>> >>> And in any case, he's updated translations that haven't been touched in >>> ages - why would they suddenly have broken? (hint: if the upstream mess= age >>> has changed, it'll be marked as fuzzy or untranslated - in other words, >>> gettext knows how to handle that). >>> >>> >>>> >>>>> >>>>>> >>>>>> On Tue, Jun 29, 2021 at 7:01 PM Dave Page wrote: >>>>>> >>>>>>> Hi >>>>>>> >>>>>>> Please send the patch without updates to the po files. Those get >>>>>>> updated as part of the release process. >>>>>>> >>>>>>> Thanks. >>>>>>> >>>>>>> On Tue, Jun 29, 2021 at 2:00 PM Rahul Shirsat < >>>>>>> rahul.shirsat@enterprisedb.com> wrote: >>>>>>> >>>>>>>> Hi Hackers, >>>>>>>> >>>>>>>> Thanks Aditya for pointing out the issue. Please find the attached >>>>>>>> patch which contains all the .po files corrected with %s. >>>>>>>> >>>>>>>> Regards, >>>>>>>> Rahul Shirsat. >>>>>>>> >>>>>>>> On Tue, Jun 29, 2021 at 4:31 PM Aditya Toshniwal < >>>>>>>> aditya.toshniwal@enterprisedb.com> wrote: >>>>>>>> >>>>>>>>> Hi Rahul, >>>>>>>>> >>>>>>>>> I did "make msg-extract" and "make msg-update" and looking at the >>>>>>>>> PO files I think it is not updated correctly. >>>>>>>>> For instance, the below message has msgstr without %s. I correcte= d >>>>>>>>> it and the error was gone. >>>>>>>>> >>>>>>>>> #: >>>>>>>>> pgadmin/browser/server_groups/servers/roles/static/js/role.js:766 >>>>>>>>> #, fuzzy, python-format >>>>>>>>> msgid "%s Objects" >>>>>>>>> msgstr "Obiekty" >>>>>>>>> >>>>>>>>> The one below had 2 %s in msgstr and I corrected it to fix the >>>>>>>>> error. >>>>>>>>> >>>>>>>>> #: >>>>>>>>> pgadmin/browser/server_groups/servers/roles/static/js/role.js:767 >>>>>>>>> #, fuzzy, python-format >>>>>>>>> msgid "Are you sure you wish to %s all the objects owned by the >>>>>>>>> selected role?" >>>>>>>>> msgstr "Czy na pewno skasowa=C4=87 %s \"%s\" i wszystkie obiekty >>>>>>>>> zale=C5=BCne od niego?" >>>>>>>>> >>>>>>>>> >>>>>>>>> You have to update the .po files to match the total %s and send >>>>>>>>> the patch. >>>>>>>>> >>>>>>>>> On Tue, Jun 29, 2021 at 1:56 PM Dave Page >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Hi >>>>>>>>>> >>>>>>>>>> On Tue, Jun 29, 2021 at 4:38 AM Rahul Shirsat < >>>>>>>>>> rahul.shirsat@enterprisedb.com> wrote: >>>>>>>>>> >>>>>>>>>>> I feel gettext sometimes won't escape the characters as it >>>>>>>>>>> should be. >>>>>>>>>>> >>>>>>>>>>> I now tried to escape those using some utils. >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> That won't work either. The string being passed to gettext() >>>>>>>>>> *must* be in the gettext call. >>>>>>>>>> >>>>>>>>>> When gettext extracts strings to create/update the catalogs, it >>>>>>>>>> will search the code for all gettext calls, and then extract a s= tring >>>>>>>>>> constant from the first argument. You cannot have variables, fun= ction calls >>>>>>>>>> or expressions in there. It *must* be a string constant. >>>>>>>>>> >>>>>>>>>> Keep in mind that msgextract is scanning the source code; it's >>>>>>>>>> not executing it. There are many examples in the code, e.g. (fro= m node.js): >>>>>>>>>> >>>>>>>>>> title =3D gettext('Drop %s?', obj.label); >>>>>>>>>> >>>>>>>>>> I don't see anything obviously wrong with the existing code. Are >>>>>>>>>> you sure there are no weird unprintable characters in there? >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Please find the updated patch. >>>>>>>>>>> >>>>>>>>>>> On Mon, Jun 28, 2021 at 9:33 PM Dave Page >>>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>>> Hi >>>>>>>>>>>> >>>>>>>>>>>> On Mon, Jun 28, 2021 at 4:57 PM Rahul Shirsat < >>>>>>>>>>>> rahul.shirsat@enterprisedb.com> wrote: >>>>>>>>>>>> >>>>>>>>>>>>> Hi Hackers, >>>>>>>>>>>>> >>>>>>>>>>>>> Please find the attached patch for fixation of jenkins failur= e. >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> That won't work - you can't include variables (or string >>>>>>>>>>>> building operations) in the first argument to gettext calls, a= s there won't >>>>>>>>>>>> be any way to extract a complete message into the catalogs. Th= e way it's >>>>>>>>>>>> being done at the moment is correct (I don't know why it's fai= ling, but >>>>>>>>>>>> it's the correct way to structure the gettext calls). >>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> Dave Page >>>>>>>>>>>> Blog: https://pgsnake.blogspot.com >>>>>>>>>>>> Twitter: @pgsnake >>>>>>>>>>>> >>>>>>>>>>>> EDB: https://www.enterprisedb.com >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> *Rahul Shirsat* >>>>>>>>>>> Senior Software Engineer | EnterpriseDB Corporation. >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Dave Page >>>>>>>>>> Blog: https://pgsnake.blogspot.com >>>>>>>>>> Twitter: @pgsnake >>>>>>>>>> >>>>>>>>>> EDB: https://www.enterprisedb.com >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Thanks, >>>>>>>>> Aditya Toshniwal >>>>>>>>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >>>>>>>>> >>>>>>>>> "Don't Complain about Heat, Plant a TREE" >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> *Rahul Shirsat* >>>>>>>> Senior Software Engineer | EnterpriseDB Corporation. >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Dave Page >>>>>>> Blog: https://pgsnake.blogspot.com >>>>>>> Twitter: @pgsnake >>>>>>> >>>>>>> EDB: https://www.enterprisedb.com >>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> Thanks, >>>>>> Aditya Toshniwal >>>>>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >>>>>> >>>>>> "Don't Complain about Heat, Plant a TREE" >>>>>> >>>>> >>>>> >>>>> -- >>>>> Dave Page >>>>> Blog: https://pgsnake.blogspot.com >>>>> Twitter: @pgsnake >>>>> >>>>> EDB: https://www.enterprisedb.com >>>>> >>>>> >>>> >>>> -- >>>> Thanks, >>>> Aditya Toshniwal >>>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >>>> >>>> "Don't Complain about Heat, Plant a TREE" >>>> >>> >>> >>> -- >>> Dave Page >>> Blog: https://pgsnake.blogspot.com >>> Twitter: @pgsnake >>> >>> EDB: https://www.enterprisedb.com >>> >>> >> >> -- >> *Rahul Shirsat* >> Senior Software Engineer | EnterpriseDB Corporation. >> > > > -- > *Rahul Shirsat* > Senior Software Engineer | EnterpriseDB Corporation. > --=20 Dave Page Blog: https://pgsnake.blogspot.com Twitter: @pgsnake EDB: https://www.enterprisedb.com --0000000000007cf55105c5f76efb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Wed, Jun 30, 2021 at 8:28 AM Ra= hul Shirsat <rahul.shi= rsat@enterprisedb.com> wrote:
Hi All,

Please find the attached patch for re= solving=C2=A0this issue wrt above suggestion.

Well that may fix the problem (and is a reasonable change), howeve= r, I think it's important that we understand the root cause. Why is thi= s failing on Linux only? Why does the following from node.js (which follows= the same pattern) work fine?

var type_label =3D g= ettext('%s Script',stype.toUpperCase());

=C2=A0
Let me know if anyone= has any queries.

On Tue, Jun 29, 2021 at 9:20 PM Rahul Shirsat <rahul.shi= rsat@enterprisedb.com> wrote:
Hi Dave / Aditya,

For a time being, Let's make = a call to gettext conditional instead of passing dynamic parameters for thi= s scenario at least. With this, we won't be touching the *.po files and= translations will do its task smoothly.
I have already checked f= or the string with weird unprintable characters, and there were none.
=

e.g.=C2=A0
Instead of -=C2=A0=C2=A0title = =3D gettext('%s objects?', obj.label);

if (drop) {
=C2=A0 =C2=A0title =3D gettext('= ;Drop objects?');
}
else {=
=C2=A0 =C2=A0title =3D gettext('Reassign objec= ts?');
}

I have tr= ied the above code and it looks good to me.

Please= suggest.

On Tue, Jun 29, 2021 at 7:31 PM Dave Page <dpage@pgadmin.org> wrote:<= br>


<= div class=3D"gmail_quote">
On Tue, Jun= 29, 2021 at 2:55 PM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com= > wrote:
Hi,

On Tue, Jun 29, 2021 at= 7:14 PM Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 29, 2021 at 2:41 PM Aditya Toshniwal &= lt;a= ditya.toshniwal@enterprisedb.com> wrote:
=
Dave,
<= div style=3D"font-family:verdana,sans-serif">
Somehow, the new text strings are added to PO wit= h incorrect translations. That is causing the issue.
Either they should be empty or fixed.

Then the source problem should be fixed= . There's no point at all in putting fixes directly in the PO files as = they'll be overwritten prior to release anyway.
The translations submitted by translators are updated in the PO fil= e right ? And then they're compiled to MO ?

Right.
=C2=A0
It's the same like Rahul = will be submitting the translations. Please correct me if I'm wrong.

That depends if he&#= 39;s changed the original message or the translated message. It's impos= sible to see without reading megabytes of text.

An= d in any case, he's updated translations that haven't been touched = in ages - why would they suddenly have broken? (hint: if the upstream messa= ge has changed, it'll be marked as fuzzy or untranslated - in other wor= ds, gettext knows how to handle that).
=C2=A0
=C2=A0

On Tue, Jun 29= , 2021 at 7:01 PM Dave Page <dpage@pgadmin.org> wrote:
Hi

Please send the patch without updates to= the po files. Those get updated as part of the release process.
=
Thanks.

On Tue, Jun 29, 2021 at 2:00 PM Rahul Shirsat= <ra= hul.shirsat@enterprisedb.com> wrote:
Hi Hackers,

Thanks Aditya for= pointing out the issue. Please=C2=A0find the attached patch which contains= all the .po files corrected with %s.

Regards,
Rahul Shirsat.

On Tue, Jun 29, 2021 at 4:31 PM Aditya Toshniwal= <aditya.toshniwal@enterprisedb.com> wrote:
Hi Rahul,<= /div>

I=C2=A0did "make msg-extract" and = &quo= t;make msg-update" and looking at the PO files I think it is= not updated correctly.
For instance, the below message has msgstr witho= ut %s. I corrected it and the error was gone.

#: pgadmin/browser/ser= ver_groups/servers/roles/static/js/role.js:766
#, fuzzy, python-formatmsgid "%s Objects"
msgstr "Obiekty"

The one= below had 2 %s in msgstr and I corrected it to fix the error.

#: pg= admin/browser/server_groups/servers/roles/static/js/role.js:767
#, fuzzy= , python-format
msgid "Are you sure you wish to %s all the objects = owned by the selected role?"
msgstr "Czy na pewno skasowa=C4= =87 %s \"%s\" i wszystkie obiekty zale=C5=BCne od niego?"

You have to update the .po files to match the total %s and send th= e patch.

On Tue, Jun 29, 2021 at 1:56 PM Dave Page <dpage@pgadmin.org> wrote:<= br>
Hi
On Tue, = Jun 29, 2021 at 4:38 AM Rahul Shirsat <rahul.shirsat@enterprisedb.com> w= rote:
I feel gettext sometimes w= on't escape the characters as it should be.

I now tr= ied to escape those using some utils.

That won't work either. The string being passed to gettext() *mu= st* be in the gettext call.

When gettext extracts = strings to create/update the catalogs, it will search the code for all gett= ext calls, and then extract a string constant from the first argument. You = cannot have variables, function calls or expressions in there. It *must* be= a string constant.=C2=A0

Keep in mind that msgext= ract is scanning the source code; it's not executing it. There are many= examples in the code, e.g. (from node.js):

title = =3D gettext('Drop %s?', obj.label);

I = don't see anything obviously wrong with the existing code. Are you sure= there are no weird unprintable characters in there?
=C2=A0
=

Please=C2=A0find the = updated patch.

On Mon, Jun 28, 2021 at 9:33 PM Dave Page <dpage@pgadmin.org> w= rote:
Hi

On Mon, Jun 28, 202= 1 at 4:57 PM Rahul Shirsat <rahul.shirsat@enterprisedb.com> wrote:
Hi Hackers,

Please= find the attached patch for fixation of jenkins failure.

That won't work - you can't include vari= ables (or string building operations) in the first argument=C2=A0to gettext= calls, as there won't be any way to extract a complete message into th= e catalogs. The way it's being done at the moment is correct (I don'= ;t know why it's failing, but it's the correct way to structure the= gettext calls).
=C2=A0
--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake

= EDB: https://www= .enterprisedb.com



--
Rahul Shirsat
Senior Software Engin= eer=C2=A0|=C2=A0EnterpriseDB=C2=A0Corporation.


--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake<= br>
EDB: http= s://www.enterprisedb.com



--
Thanks,
Aditya Toshniwal=
pgAdmin hacker=C2=A0| Sr. Software Engineer | edbpostgres.com
&quo= t;Don't Complain about Heat, Plant a TREE"


--
Rahul Shirsat
Senior Software Engin= eer=C2=A0|=C2=A0EnterpriseDB=C2=A0Corporation.


--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake<= br>
EDB: http= s://www.enterprisedb.com



--
Thanks,
Aditya Toshniwal=
pgAdmin hacker=C2=A0| Sr. Software Engineer | edbpostgres.com
&quo= t;Don't Complain about Heat, Plant a TREE"


--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake<= br>
EDB: http= s://www.enterprisedb.com



--
Thanks,
Aditya Toshniwal=
pgAdmin hacker=C2=A0| Sr. Software Engineer | edbpostgres.com
&quo= t;Don't Complain about Heat, Plant a TREE"


--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake<= br>
EDB: http= s://www.enterprisedb.com



--
Rahul Shirsat
Senior Software Engin= eer=C2=A0|=C2=A0EnterpriseDB=C2=A0Corporation.


--
Rahul Shirsat
Senior Software Engin= eer=C2=A0|=C2=A0EnterpriseDB=C2=A0Corporation.


--
<= /div> --0000000000007cf55105c5f76efb--