Portable Mode not working #21

Closed
opened 2023-03-07 16:48:23 +10:30 by AJolly · 7 comments
AJolly commented 2023-03-07 16:48:23 +10:30 (Migrated from github.com)

At least on windows, it seems to always load the config from AppData\Roaming\Gropple\config.yml, even if theres already a config.yml in the same folder as gropple.exe

At least on windows, it seems to always load the config from AppData\Roaming\Gropple\config.yml, even if theres already a config.yml in the same folder as gropple.exe
tardisx commented 2023-03-07 17:04:47 +10:30 (Migrated from github.com)

How are you executing gropple.exe? The code is currently looking in the "current directory" - not "directory the binary is in" - is that the problem?

How are you executing gropple.exe? The code is currently looking in the "current directory" - not "directory the binary is in" - is that the problem?
AJolly commented 2023-03-07 18:07:38 +10:30 (Migrated from github.com)

No matter what I do, I seem unable to have it access the settings in the
current directory / or directory the gropple exe is in.
I've tried via search everything, windows explorer, and via command prompt:

FWIW, I've never seen a portable app on windows look for settings relative
to or in the "current" directory, and not the directory the exe is in.
Never even occurred to me that it might work that way.

Microsoft Windows [Version 10.0.22621.1265]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Jolly>cd c:\ccdc\PortableApps\gropple

c:\ccdc\PortableApps\Gropple>dir *.yml
Volume in drive C has no label.
Volume Serial Number is 8E2B-8CD8

Directory of c:\ccdc\PortableApps\Gropple

01/11/2023 12:10 AM 693 config.yml
1 File(s) 693 bytes
0 Dir(s) 903,394,631,680 bytes free

c:\ccdc\PortableApps\Gropple>

c:\ccdc\PortableApps\Gropple>gropple.exe
2023/03/07 03:34:38 Starting gropple v0.5.5 -
https://github.com/tardisx/gropple
2023/03/07 03:34:38 Configuration loaded from
C:\Users\Jolly\AppData\Roaming\gropple\config.yml
2023/03/07 03:34:38 Visit http://localhost:25222 for details on installing
the bookmarklet and to check status

On Tue, Mar 7, 2023 at 2:34 AM Justin Hawkins @.***>
wrote:

How are you executing gropple.exe? The code is currently looking in the
"current directory" - not "directory the binary is in" - is that the
problem?


Reply to this email directly, view it on GitHub
https://github.com/tardisx/gropple/issues/21#issuecomment-1457621769,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAWKZL5LMB7UIBVCOA634DW23JJDANCNFSM6AAAAAAVSBMFWE
.
You are receiving this because you authored the thread.Message ID:
@.***>

No matter what I do, I seem unable to have it access the settings in the current directory / or directory the gropple exe is in. I've tried via search everything, windows explorer, and via command prompt: FWIW, I've never seen a portable app on windows look for settings relative to or in the "current" directory, and not the directory the exe is in. Never even occurred to me that it might work that way. Microsoft Windows [Version 10.0.22621.1265] (c) Microsoft Corporation. All rights reserved. C:\Users\Jolly>cd c:\ccdc\PortableApps\gropple c:\ccdc\PortableApps\Gropple>dir *.yml Volume in drive C has no label. Volume Serial Number is 8E2B-8CD8 Directory of c:\ccdc\PortableApps\Gropple 01/11/2023 12:10 AM 693 config.yml 1 File(s) 693 bytes 0 Dir(s) 903,394,631,680 bytes free c:\ccdc\PortableApps\Gropple> c:\ccdc\PortableApps\Gropple>gropple.exe 2023/03/07 03:34:38 Starting gropple v0.5.5 - https://github.com/tardisx/gropple 2023/03/07 03:34:38 Configuration loaded from C:\Users\Jolly\AppData\Roaming\gropple\config.yml 2023/03/07 03:34:38 Visit http://localhost:25222 for details on installing the bookmarklet and to check status On Tue, Mar 7, 2023 at 2:34 AM Justin Hawkins ***@***.***> wrote: > How are you executing gropple.exe? The code is currently looking in the > "current directory" - not "directory the binary is in" - is that the > problem? > > — > Reply to this email directly, view it on GitHub > <https://github.com/tardisx/gropple/issues/21#issuecomment-1457621769>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAAWKZL5LMB7UIBVCOA634DW23JJDANCNFSM6AAAAAAVSBMFWE> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
AJolly commented 2023-03-07 18:08:51 +10:30 (Migrated from github.com)

One other thing to note - it looks for yt-dlp in the output directory, not
in the directory with gropple.exe

On Tue, Mar 7, 2023 at 3:37 AM Jolly @.***> wrote:

No matter what I do, I seem unable to have it access the settings in the
current directory / or directory the gropple exe is in.
I've tried via search everything, windows explorer, and via command prompt:

FWIW, I've never seen a portable app on windows look for settings relative
to or in the "current" directory, and not the directory the exe is in.
Never even occurred to me that it might work that way.

Microsoft Windows [Version 10.0.22621.1265]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Jolly>cd c:\ccdc\PortableApps\gropple

c:\ccdc\PortableApps\Gropple>dir *.yml
Volume in drive C has no label.
Volume Serial Number is 8E2B-8CD8

Directory of c:\ccdc\PortableApps\Gropple

01/11/2023 12:10 AM 693 config.yml
1 File(s) 693 bytes
0 Dir(s) 903,394,631,680 bytes free

c:\ccdc\PortableApps\Gropple>

c:\ccdc\PortableApps\Gropple>gropple.exe
2023/03/07 03:34:38 Starting gropple v0.5.5 -
https://github.com/tardisx/gropple
2023/03/07 03:34:38 Configuration loaded from
C:\Users\Jolly\AppData\Roaming\gropple\config.yml
2023/03/07 03:34:38 Visit http://localhost:25222 for details on
installing the bookmarklet and to check status

On Tue, Mar 7, 2023 at 2:34 AM Justin Hawkins @.***>
wrote:

How are you executing gropple.exe? The code is currently looking in the
"current directory" - not "directory the binary is in" - is that the
problem?


Reply to this email directly, view it on GitHub
https://github.com/tardisx/gropple/issues/21#issuecomment-1457621769,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAWKZL5LMB7UIBVCOA634DW23JJDANCNFSM6AAAAAAVSBMFWE
.
You are receiving this because you authored the thread.Message ID:
@.***>

One other thing to note - it looks for yt-dlp in the output directory, not in the directory with gropple.exe On Tue, Mar 7, 2023 at 3:37 AM Jolly ***@***.***> wrote: > No matter what I do, I seem unable to have it access the settings in the > current directory / or directory the gropple exe is in. > I've tried via search everything, windows explorer, and via command prompt: > > FWIW, I've never seen a portable app on windows look for settings relative > to or in the "current" directory, and not the directory the exe is in. > Never even occurred to me that it might work that way. > > Microsoft Windows [Version 10.0.22621.1265] > (c) Microsoft Corporation. All rights reserved. > > C:\Users\Jolly>cd c:\ccdc\PortableApps\gropple > > > c:\ccdc\PortableApps\Gropple>dir *.yml > Volume in drive C has no label. > Volume Serial Number is 8E2B-8CD8 > > Directory of c:\ccdc\PortableApps\Gropple > > 01/11/2023 12:10 AM 693 config.yml > 1 File(s) 693 bytes > 0 Dir(s) 903,394,631,680 bytes free > > c:\ccdc\PortableApps\Gropple> > > c:\ccdc\PortableApps\Gropple>gropple.exe > 2023/03/07 03:34:38 Starting gropple v0.5.5 - > https://github.com/tardisx/gropple > 2023/03/07 03:34:38 Configuration loaded from > C:\Users\Jolly\AppData\Roaming\gropple\config.yml > 2023/03/07 03:34:38 Visit http://localhost:25222 for details on > installing the bookmarklet and to check status > > > On Tue, Mar 7, 2023 at 2:34 AM Justin Hawkins ***@***.***> > wrote: > >> How are you executing gropple.exe? The code is currently looking in the >> "current directory" - not "directory the binary is in" - is that the >> problem? >> >> — >> Reply to this email directly, view it on GitHub >> <https://github.com/tardisx/gropple/issues/21#issuecomment-1457621769>, >> or unsubscribe >> <https://github.com/notifications/unsubscribe-auth/AAAWKZL5LMB7UIBVCOA634DW23JJDANCNFSM6AAAAAAVSBMFWE> >> . >> You are receiving this because you authored the thread.Message ID: >> ***@***.***> >> >
tardisx commented 2023-03-08 10:06:34 +10:30 (Migrated from github.com)

Thanks for the follow up info - it's very useful.

Firstly, it definitely doesn't look for yt-dlp in the output directory. If interested, see c1c1fc1866/config/config.go (L172) where gropple runs your executable, and where it is checked to see if it is on your path (or fully qualified). You may not be running the yt-dlp executable you think you are, or your path is unusual.

That said, looking at https://pkg.go.dev/os/exec#hdr-Executables_in_the_current_directory which was a change in Go 1.19. Since the most recent Gropple was compiled with an older version (1.16) it could be that it is seeing yt-dlp in your current directory, even if it's not on your path. That would explain what you're seeing - you start gropple in your output folder, yt-dlp is there, and you have the command configured as just "yt-dlp". I will update to Go 1.20 next release, so don't rely on this behaviour, as the link documents it is a security problem.

To be clear, this is completely unrelated to config file handling.

Re: loading the config from the binary directory instead of the current directory - agreed this is incorrect. I don't use windows nor have a need for a portable binary so it has not had more than a cursory look. I agree even the current incorrect behaviour should work in your case that you pasted. I will leave this open to change it to look in the binary directory - that definitely makes more sense and I can't imagine anyone is usefully using the current broken behaviour.

Thanks for the follow up info - it's very useful. Firstly, it definitely doesn't look for yt-dlp in the output directory. If interested, see https://github.com/tardisx/gropple/blob/c1c1fc1866bce4b499d6a1cc442210534f4d207c/config/config.go#L172 where gropple runs your executable, and where it is checked to see if it is on your path (or fully qualified). You may not be running the yt-dlp executable you think you are, or your path is unusual. That said, looking at https://pkg.go.dev/os/exec#hdr-Executables_in_the_current_directory which was a change in Go 1.19. Since the most recent Gropple was compiled with an older version (1.16) it could be that it is seeing yt-dlp in your current directory, even if it's not on your path. That would explain what you're seeing - you start gropple in your output folder, yt-dlp is there, and you have the command configured as just "yt-dlp". I will update to Go 1.20 next release, so don't rely on this behaviour, as the link documents it is a security problem. To be clear, this is completely unrelated to config file handling. Re: loading the config from the binary directory instead of the current directory - agreed this is incorrect. I don't use windows nor have a need for a portable binary so it has not had more than a cursory look. I agree even the current incorrect behaviour should work in your case that you pasted. I will leave this open to change it to look in the binary directory - that definitely makes more sense and I can't imagine anyone is usefully using the current broken behaviour.
tardisx commented 2023-03-09 21:27:40 +10:30 (Migrated from github.com)

Can you see if the latest version fixes your problem:

https://github.com/tardisx/gropple/releases/tag/v0.6.0-alpha.2

Note - it's an alpha release and some stuff may be broken.

Please note, when looking for a portable config, the filename is "gropple.yml" - not "config.yml". This would have been why it did not work for you even in the current directory.

Can you see if the latest version fixes your problem: https://github.com/tardisx/gropple/releases/tag/v0.6.0-alpha.2 Note - it's an alpha release and some stuff may be broken. Please note, when looking for a portable config, the filename is "gropple.yml" - not "config.yml". This would have been why it did not work for you even in the current directory.
AJolly commented 2023-03-18 11:46:20 +10:30 (Migrated from github.com)

Latest version works!
(I was a bit surprised about it looking for gropple.yml though, I would have assumed the config file would be named the same regardless of location)

Latest version works! (I was a bit surprised about it looking for gropple.yml though, I would have assumed the config file would be named the same regardless of location)
tardisx commented 2023-03-18 13:10:00 +10:30 (Migrated from github.com)

Thanks for testing!

The reason for the name change is that in normal mode the config.yaml file is stored in a folder named "gropple".

In portable mode, a generic name might not obviously go with the exe, or worse, might clash with some other portable exe in the same directory.

Thanks for testing! The reason for the name change is that in normal mode the config.yaml file is stored in a folder named "gropple". In portable mode, a generic name might not obviously go with the exe, or worse, might clash with some other portable exe in the same directory.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: justin/gropple#21
No description provided.