Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-5453

Powershell Module Manifest file (.psd1) are detected as binary instead of text. (BB-6714)

      In the detailed commit window, we can not see the diff for a .psd1 file (Message "Binary file modified"), .psd1 are text file : http://msdn.microsoft.com/en-us/library/windows/desktop/dd878337%28v=vs.85%29.aspx

      This is a very, very minor issue

      Edit : it seems the problem is in fact with unicode encoding, like describe in BCLOUD-5648

      Also, these extensions:
      .PS1 – Windows PowerShell shell script
      .PSD1 – Windows PowerShell data file (for Version 2)
      .PSM1 – Windows PowerShell module file (for Version 2)
      .PS1XML – Windows PowerShell format and type definitions
      .CLIXML - Windows PowerShell serialized data
      .PSC1 – Windows PowerShell console file
      .PSSC - Windows PowerShell Session Configuration file

            [BCLOUD-5453] Powershell Module Manifest file (.psd1) are detected as binary instead of text. (BB-6714)

            ibenr added a comment -

            Attachment 2492074617-bitbucket-text-file-clean.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment - Attachment 2492074617-bitbucket-text-file-clean.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment -

            Attachment 3400078252-powergui-utf8.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment - Attachment 3400078252-powergui-utf8.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment -

            Attachment 3112659033-powergui-scripteditoressentials.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment - Attachment 3112659033-powergui-scripteditoressentials.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment -

            Attachment 3057842292-powergui-powershell-libraries.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment - Attachment 3057842292-powergui-powershell-libraries.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment -

            Attachment 249354462-bitbucket-binary-file-clean.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment - Attachment 249354462-bitbucket-binary-file-clean.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment -

            Attachment 2815732951-bitbucket-binary.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ibenr added a comment - Attachment 2815732951-bitbucket-binary.png has been added with description: Originally embedded in Bitbucket issue #5453 in site/master

            ofoissac added a comment -

            Attachment ps1unicode.jpg has been added with description: Originally attached to Bitbucket issue #5453 in site/master

            ofoissac added a comment - Attachment ps1unicode.jpg has been added with description: Originally attached to Bitbucket issue #5453 in site/master

            This issue has been closed due to inactivity. If you continue to see problems, please reopen or create a new issue.

            Legacy Bitbucket Cloud User (Inactive) added a comment - This issue has been closed due to inactivity. If you continue to see problems, please reopen or create a new issue.

            Issue BCLOUD-10334 was marked as a duplicate of this issue.

            Legacy Bitbucket Cloud User (Inactive) added a comment - Issue BCLOUD-10334 was marked as a duplicate of this issue.

            Issue BCLOUD-10304 was marked as a duplicate of this issue.

            Legacy Bitbucket Cloud User (Inactive) added a comment - Issue BCLOUD-10304 was marked as a duplicate of this issue.

            ibenr added a comment -

            We use the following workflow to update powershell scripts in bitbucket and had this same issue when getting started out of the box with defaults...

            The default files created with PowerGui are having the 3 letter file name extension ps1 but when uploaded with Sourcetree they show up in Bitbucket as Binary so text features like edit or diff don't work. Based on the feedback here and with other google searches the fix for this was to indeed change the encoding to UTF-8, make a simple change to the file, and upload it again. After a few tries this works perfectly and is repeatable. There is a trick though as PowerGUI doesn't make it obvious how to change the encoding. Here are the steps...

            1. start powergui as you normally would. BTW - this is a windows program and I've tested this on Windows 8
            2. Choose "PowerShell Libraries" from the File menu
            3. Check the box to enable "Add-on.ScriptEditorEssentials" from the Snapins/Modules dialog box. Click OK.
            4. Now Enable UTF-8 Encoding from the File menu.
            5. That's it. Any file you save now will be UTF-8 encoded and show up properly in Bitbucket once uploaded.

            Reference:
            http://en.community.dell.com/techcenter/powergui/f/4833/t/19575613.aspx

            ibenr added a comment - We use the following workflow to update powershell scripts in bitbucket and had this same issue when getting started out of the box with defaults... Dell Quest free PowerGui tool (version 3.8) - http://en.community.dell.com/techcenter/powergui/m/ Atlassian SourceTree - http://www.sourcetreeapp.com/ Bitbucket - https://bitbucket.org/ The default files created with PowerGui are having the 3 letter file name extension ps1 but when uploaded with Sourcetree they show up in Bitbucket as Binary so text features like edit or diff don't work. Based on the feedback here and with other google searches the fix for this was to indeed change the encoding to UTF-8, make a simple change to the file, and upload it again. After a few tries this works perfectly and is repeatable. There is a trick though as PowerGUI doesn't make it obvious how to change the encoding. Here are the steps... start powergui as you normally would. BTW - this is a windows program and I've tested this on Windows 8 Choose "PowerShell Libraries" from the File menu Check the box to enable "Add-on.ScriptEditorEssentials" from the Snapins/Modules dialog box. Click OK. Now Enable UTF-8 Encoding from the File menu. That's it. Any file you save now will be UTF-8 encoded and show up properly in Bitbucket once uploaded. Reference: http://en.community.dell.com/techcenter/powergui/f/4833/t/19575613.aspx

            interestingly when you create repository it allows you to select powershell as a language to select from, This means it is aware of it, but when you click on powershell script file to check it source it is treated as binary and simply pops download dialogue box. I can't even see the source

            Update: had to save *.ps1 with ANSI encoding (instead of Unicode) in order make it identified as a text file

            Legacy Bitbucket Cloud User (Inactive) added a comment - interestingly when you create repository it allows you to select powershell as a language to select from, This means it is aware of it, but when you click on powershell script file to check it source it is treated as binary and simply pops download dialogue box. I can't even see the source Update: had to save *.ps1 with ANSI encoding (instead of Unicode) in order make it identified as a text file

            Nice catch Olivier! That is indeed the problem. I changed the encoding to utf-8 and its all good. Thanks

            avnersilberman added a comment - Nice catch Olivier! That is indeed the problem. I changed the encoding to utf-8 and its all good. Thanks

            ofoissac added a comment -

            I didn't notice before, but it works with ps1 ,psm1 and psd1, it seems that it's the same problem than https://bitbucket.org/site/master/issue/5648/utf-16-little-endian-files-are-downloaded or https://bitbucket.org/site/master/issue/5106/bb-thrown-off-by-utf16le-byte-order-mark.\\
            I updated the issue with a screen capture of the test, so it should probably be mark as duplicate.

            @avnersilberman : What is the encoding of your ps1 files ?

            ofoissac added a comment - I didn't notice before, but it works with ps1 ,psm1 and psd1, it seems that it's the same problem than https://bitbucket.org/site/master/issue/5648/utf-16-little-endian-files-are-downloaded or https://bitbucket.org/site/master/issue/5106/bb-thrown-off-by-utf16le-byte-order-mark.\\ I updated the issue with a screen capture of the test, so it should probably be mark as duplicate. @avnersilberman : What is the encoding of your ps1 files ?

            This applies to .ps1 files as well. I think this is pretty serious, as for windows development a lot of scripts are now in powershell as opposed to .cmd or .bat.

            Seriously though - how hard is it to get these treated like any other source file? Surely this is configuration and not a code change?

            Would appreciate some feedback on any plans to fix this.

            avnersilberman added a comment - This applies to .ps1 files as well. I think this is pretty serious, as for windows development a lot of scripts are now in powershell as opposed to .cmd or .bat. Seriously though - how hard is it to get these treated like any other source file? Surely this is configuration and not a code change? Would appreciate some feedback on any plans to fix this.

              Unassigned Unassigned
              14b1de4687ab ofoissac
              Affected customers:
              4 This affects my team
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: