Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while opening files whose name starts/ends with = (v8.5, 32b) #13344

Closed
GGa-JJa opened this issue Mar 13, 2023 · 21 comments
Closed

Error while opening files whose name starts/ends with = (v8.5, 32b) #13344

GGa-JJa opened this issue Mar 13, 2023 · 21 comments

Comments

@GGa-JJa
Copy link

GGa-JJa commented Mar 13, 2023

Description of the Issue

Error while opening files whose name starts/ends with =

Steps to Reproduce the Issue

  1. Create a file whose name starts and ends with =, e.g. =NOTE=
  2. Open the file with this command: "C:\Program Files\npp\notepad++.exe" "P:\ath\of\file\=NOTE=" (or similar, with the correct paths of course)
  3. The program opens the file, but it also displays a "cannot open file" error box (see picture).

Expected Behavior

(just open the file)

Actual Behavior

(also an error messagebox)

Debug Information

It's Notepad++ v8.5, 32 bit.
Doing the same as described above was not a problem with older versions, e.g. 6.7.9.2
immagine

@molsonkiko
Copy link
Contributor

Tried on v8.5 64bit and 32bit, both using terminal and opening with the file explorer. I couldn't replicate it.

@GGa-JJa
Copy link
Author

GGa-JJa commented Mar 14, 2023

Oh... how strange.
What OS did you use?
(I tried on Windows 10, on an office PC where I cannot install things - I just copied the files from the "portable" download)

Thak you for trying!

@molsonkiko
Copy link
Contributor

I also am on Windows 10.

@rddim
Copy link
Contributor

rddim commented Mar 15, 2023

Confirm

Open =note= with error message
Open note= with error message
Open =note without error message

Debug Info Win 11

Notepad++ v8.5   (64-bit)
Build time : Mar  6 2023 - 02:18:13
Path : D:\Notepad++\notepad++.exe
Command Line : "D:\Notepad++\note="
Admin mode : OFF
Local Conf mode : ON
Cloud Config : D:\Notepad++\_settings
OS Name : Windows 11 Pro (64-bit)
OS Version : 21H2
OS Build : 22000.1696
Current ANSI codepage : 1251
Plugins : 
    AutoSave (2)
    ComparePlus (1.1)
    VisualStudioLineCopy (1.0.0.2)

Later today I will test with Win 7

Update:

Same issue with Win 7
The last "stable" version is 8.4.7

@xomx
Copy link
Contributor

xomx commented Mar 16, 2023

@molsonkiko

I couldn't replicate it.

Did you try the OP's STR without or with param quotes (as in STR)?

This works ok for me (invoked from my N++ directory):
notepad++.exe C:\TEMP\=NOTE=

This does not (the error message about nonexisting " " file appears):
notepad++.exe "C:\TEMP\=NOTE="

Possible fix:
I do not have a time for debugging & PR, sorry, but I try shooting in the dark - just try to replace this line with the following code (taken from my previously rejected PR}:

			if ((i + 1) < nbFilesToOpen)
				quotFileName += TEXT("\" "); // use 'space'-char delimiter
			else
				quotFileName += TEXT("\""); // last item

@GGa-JJa
Copy link
Author

GGa-JJa commented Mar 16, 2023

Confirm

Open =note= with error message
Open note= with error message
Open =note without error message

Yes, I made some more "testing" and it's the same: the = at the end of the name is the problem.
The same error applies for files like "note.txt=", but not for "note=.txt".

A question for molsonkiko that couldn't replicate: of course, you are not hiding the file extension (like some geniuses at microsoft think should be the default), right?

@GGa-JJa
Copy link
Author

GGa-JJa commented Mar 16, 2023

This works ok for me (invoked from my N++ directory): notepad++.exe C:\TEMP\=NOTE=
This does not (the error message about nonexisting " " file appears): notepad++.exe "C:\TEMP\=NOTE="

Very interesting, I didn't try this! (B.t.w. thany you all for trying!).
My files are opened with quotes for two reasons:

  1. There may be spaces, as usual, and
  2. The command is written in the registry, and as a non-administrator I cannot edit it (I could just replace the NP++ program, but the registry is off-limits).

Any ideas for a workaround? (Except renaming the .exe and replacing it with another program that modifies the arguments and then calls the renamed .exe...)
Or should I think that a new version will soon correct the issue?

(It may seeem very silly, but I have notes and explanations for nearly all my works in files named with that pattern... funny, eh?)

@molsonkiko
Copy link
Contributor

molsonkiko commented Mar 16, 2023

I have been doing this without an extension.

Trying it again with and without quotes, I found the following:

name quotes? result
=note yes good
note= yes bad
=note= yes bad
=note no good
note= no good
=note= no good

This is consistent with what you all have observed.

@molsonkiko
Copy link
Contributor

Just for fun, I also tried filenames ending in _, ~, ^, v, -, ), and (. None of those ending characters caused weird behavior whether in or out of quotes (if possible; v can't be outside of quotes)

@Yaron10
Copy link

Yaron10 commented Jul 22, 2023

Doing the same as described above was not a problem with older versions, e.g. 6.7.9.2

This regression was introduced in a relatively recent version.

@jofon
Copy link
Contributor

jofon commented Jul 22, 2023

@Yaron10
Before the error dialog was introduced by #12613, in v8.4.8, the problem would be silently ignored.

@Yaron10
Copy link

Yaron10 commented Jul 22, 2023

@jofon,

Thank you for pointing that out.

The last "stable" version is 8.4.7

I've just noticed that sentence by @rddim.

@GGa-JJa
Copy link
Author

GGa-JJa commented Jul 22, 2023

Happy (and honoured!) to notice that someone took care of "my" problem ^_^
(Thank you)

So, any hope of a fix in a "stable" new version?

@donho donho closed this as completed in 3ea789c Jul 27, 2023
@Yaron10
Copy link

Yaron10 commented Aug 4, 2023

A rare case. Just for the record.

Change a new tab name to Test (Test + Space).
Open the Find dialog and "Find All in Current Document".
Double-click an entry in the Search Results window.

Result:
An error message: "Cannot open file Test ".

@alankilborn
Copy link
Contributor

Change a new tab name to to Test (Test + Space).

IMO, a soft-named tab should not be allowed to have space(s) before the first (non-space) character, nor after the last (non-space) character. [ It feels unclean just typing that. :-) ]

It just isn't necessary. This should have been thought of when renaming of soft-named (i.e., new #) tabs was implemented. A user-supplied name should have been "trimmed" of whitespace on the left side and the right side.

@Yaron10
Copy link

Yaron10 commented Aug 4, 2023

@alankilborn,

I agree. Do you think it's worth the extra code?

It occurred to me to test it after seeing @donho's nice PR (#13960).
The Search Results' "title" is apparently "New ", and I was wondering what should happen if there was a tab named "New ".

@alankilborn
Copy link
Contributor

Do you think it's worth the extra code?

I do; it shouldn't be much code.

The Search Results' "title" is apparently "New "

Maybe it should be given a better title, even if there is no purpose (user wouldn't see it) other than to avoid potential "N++ programmer" confusion at some future point.

@Yaron10
Copy link

Yaron10 commented Aug 4, 2023

I do; it shouldn't be much code.

OK.

Maybe it should be given a better title, even if there is no purpose (user wouldn't see it) other than to avoid potential "N++ programmer" confusion at some future point.

I see your point.
And again I'm wondering if it's worth the extra code. :)
I suppose @donho should see this.

@donho
Copy link
Member

donho commented Aug 4, 2023

Do you think it's worth the extra code?

I do; it shouldn't be much code.

@alankilborn
If you're interested in doing it, then go ahead please. Otherwise I'm gonna fix it.

@alankilborn
Copy link
Contributor

If you're interested in doing it

@donho I would, but I'm currently not set up to do so; I've been trying for a while to find time to get my new PC fully set up, but I'm not there yet.

Otherwise I'm gonna fix it.

Please go ahead. Thank you.

@Yaron10
Copy link

Yaron10 commented Aug 4, 2023

@donho,

Otherwise I'm gonna fix it.

Thank you.

@alankilborn,

Congratulations!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants