public inbox for [email protected]
help / color / mirror / Atom feedFrom: Akshay Joshi <[email protected]>
To: Dave Page <[email protected]>
Cc: Khushboo Vashi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch] - RM #3309 - Backup does not work with --format=d
Date: Tue, 17 Jul 2018 13:31:36 +0530
Message-ID: <CANxoLDca87eGeNhSSB5Lvmj6Sj2ucnPhCvcarnCcsbt02G6dGg@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoy6xZO4mda89HCS6J87dMT_m4mv5Jg6tesgkzoLQ5QCBA@mail.gmail.com>
References: <CAFOhELcKP1eRWNwtT3=UVoKPiwR2Pt6LhS+=C0D8vCs1AiK3GQ@mail.gmail.com>
<CA+OCxoyCFZgqa5qKxatwVp9kQ8PO7_EXTWZTZgtNKDwRv=cTyg@mail.gmail.com>
<CAFOhELdWjX3czSKSPEq_8ynq8e-Sx+wPhTtCESLvq-iC0OoFKg@mail.gmail.com>
<CA+OCxoyap_9ZiSDVXYpumi-e9w0tyxXJUMvUFwV9Twm2F5K2wA@mail.gmail.com>
<CAFOhELcmC_kJAtVuOUQ-yJhn559oMt_v0FwUX_d3vn_ZWFENuw@mail.gmail.com>
<CA+OCxoy6xZO4mda89HCS6J87dMT_m4mv5Jg6tesgkzoLQ5QCBA@mail.gmail.com>
Hi Hackers,
Attached is the patch to fix the issue on Windows operating system with
"--format=d".
On Fri, Jun 29, 2018 at 7:46 PM, Dave Page <[email protected]> wrote:
> Thanks, applied.
>
> On Fri, Jun 29, 2018 at 10:24 AM, Khushboo Vashi <
> [email protected]> wrote:
>
>> Hi,
>>
>> Please find the attached updated patch.
>>
>> Thanks,
>> Khushboo
>>
>> On Mon, Jun 25, 2018 at 8:07 PM, Dave Page <[email protected]> wrote:
>>
>>>
>>>
>>> On Mon, Jun 25, 2018 at 3:33 PM, Khushboo Vashi <
>>> [email protected]> wrote:
>>>
>>>>
>>>>
>>>> On Mon, 25 Jun 2018, 19:47 Dave Page, <[email protected]> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> On Mon, Jun 25, 2018 at 1:23 PM, Khushboo Vashi <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Please find the attached patch for RM #3309 - Backup does not work
>>>>>> with --format=d.
>>>>>>
>>>>>> Fixes in the patch :
>>>>>>
>>>>>> 1. Format = directory fix for Backup and Restore utilities
>>>>>> 2. Test cases for format = directory
>>>>>> 2. File manager fix - The selected directory was not properly
>>>>>> populated in the text box
>>>>>>
>>>>>
>>>>> The patch disables the file picker button if you select Directory
>>>>> format. This seems like poor behaviour; I think we need to modify the
>>>>> dialogue to allow a directory to be selected.
>>>>>
>>>>>
>>>> In the directory format, which ever the folder name given, that will be
>>>> created by pg_dump, so I have disabled it.
>>>>
>>>
>>> Sure, but I can't even browse to the location I want to put it now - I
>>> have to manually type in the path. We just need to allow selection of the
>>> directory that will contain the directory.
>>>
>>>
>> Fixed.
>>
>>> 3. Refactoring of File manager JS file
>>>>>>
>>>>>
>>>>> That's somewhat more readable. Can we add tests?
>>>>>
>>>> Will look into it.
>>>>
>>>
>>> Added.
>>
>>> Thanks.
>>>
>>>
>>>>
>>>>> --
>>>>> Dave Page
>>>>> Blog: http://pgsnake.blogspot.com
>>>>> Twitter: @pgsnake
>>>>>
>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
--
*Akshay Joshi*
*Sr. Software Architect *
*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
Attachments:
[application/octet-stream] RM_3309_Windows.patch (1.3K, 3-RM_3309_Windows.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/backup/__init__.py b/web/pgadmin/tools/backup/__init__.py
index e41530f..2438e6d 100644
--- a/web/pgadmin/tools/backup/__init__.py
+++ b/web/pgadmin/tools/backup/__init__.py
@@ -243,7 +243,17 @@ def filename_with_file_manager_path(_file, create_file=True):
with open(_file, 'a'):
pass
- return fs_short_path(_file)
+ short_path = fs_short_path(_file)
+
+ # fs_short_path() function may return empty path on Windows
+ # if directory doesn't exists. In that case we strip the last path
+ # component and get the short path.
+ if os.name == 'nt' and short_path == '':
+ base_name = os.path.basename(_file)
+ dir_name = os.path.dirname(_file)
+ short_path = fs_short_path(dir_name) + '\\' + base_name
+
+ return short_path
@blueprint.route(
diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py
index 54a599c..75bef23 100644
--- a/web/pgadmin/utils/__init__.py
+++ b/web/pgadmin/utils/__init__.py
@@ -223,6 +223,8 @@ if IS_WIN:
buf_size = len(_path)
while True:
res = ctypes.create_unicode_buffer(buf_size)
+ # Note:- _GetShortPathNameW may return empty value
+ # if directory doesn't exists.
needed = _GetShortPathNameW(_path, res, buf_size)
if buf_size >= needed:
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: [pgAdmin4][Patch] - RM #3309 - Backup does not work with --format=d
In-Reply-To: <CANxoLDca87eGeNhSSB5Lvmj6Sj2ucnPhCvcarnCcsbt02G6dGg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox