Saving and sign script removes last charactor in script

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
jessondergaard
Posts: 2
Joined: Thu Sep 19, 2013 2:36 am

Saving and sign script removes last charactor in script

Post by jessondergaard »

To help you better we need some information from you.

Product, version and build: SAPIEN PowerShell Studio 2019, Version 5.6.160
32 or 64 bit version of product: 64 bit
Operating system: Windows 10 Enterprise 1709 OS Build 16299.1029
32 or 64 bit OS: 64 Bit

*** Please add details and screenshots as needed below. ***
When ever I save my script on PowerShell Studio it removes at last charactor in the script.
It seems to be related to the automatic signing of the script.
However it does not happen when I just select "Sign Script".
If I remove the setting to automatically sign the script on save, the error is gone.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Saving and sign script removes last charactor in script

Post by davidc »

Is the file using Unix line ends?
David
SAPIEN Technologies, Inc.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Saving and sign script removes last charactor in script

Post by davidc »

If you are using Unix line endings, the signing process unfortunately chops the last line because it expects and uses Windows line ends.
I will ask the Dev team to look into it, but since the signing process is external, I'm not sure there much we can do.
David
SAPIEN Technologies, Inc.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Saving and sign script removes last charactor in script

Post by davidc »

I confirmed this also occurs if you use the Set-AuthenticodeSignature cmdlet.
David
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 7398
Joined: Tue May 29, 2007 4:43 pm

Re: Saving and sign script removes last charactor in script

Post by Alexander Riedel »

It's a bug in the WIndows API basically, it assumes that ALL files are CR/LF and acts accordingly. We will see what we can do as a workaround.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
jessondergaard
Posts: 2
Joined: Thu Sep 19, 2013 2:36 am

Re: Saving and sign script removes last charactor in script

Post by jessondergaard »

I have now changed the file to use Windows CRLF line ends and then the problem is gone.
I was not aware of this, an actually not sure why the files was in Unix format. So this workaround is good enough for me.

Thank you for your quick help on this.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Saving and sign script removes last charactor in script

Post by davidc »

We made some changes to hopefully work around the issue in case someone else uses Unix line endings.
David
SAPIEN Technologies, Inc.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Saving and sign script removes last charactor in script

Post by davidc »

We released the v5.6.161 service build that includes the work around.
David
SAPIEN Technologies, Inc.

Locked