Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Error on execution with Git plugin when executing update.ps1 #129

Closed
echizenryoma opened this issue Mar 4, 2018 · 17 comments
Closed

Error on execution with Git plugin when executing update.ps1 #129

echizenryoma opened this issue Mar 4, 2018 · 17 comments
Labels

Comments

@echizenryoma
Copy link

echizenryoma commented Mar 4, 2018

I got this error message:

Running Git
  ERROR:
   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
   + FullyQualifiedErrorId : NullArray
@Thilas
Copy link
Collaborator

Thilas commented Mar 11, 2018

Could you provide more information about how you get this error? Any git repo? Gist? AV log?

@majkinetor majkinetor changed the title error on execution with Git plugin when executing update.ps1 Error on execution with Git plugin when executing update.ps1 Mar 11, 2018
@echizenryoma
Copy link
Author

echizenryoma commented Mar 12, 2018

PS D:\Project\Chocolatey-Package> .\update_all.ps1
Updating 48 automatic packages at 2018-03-12 09:42:22
Push is disabled
.....
   [5/48] cemu is updated to 1.11.5 (16.39s)
.....

Running History
Saving history to D:\Project\Chocolatey-Package\Update-History.md

Running Gist
........

Running Git
  ERROR:
    Cannot index into a null array.

Finished 48 packages after .83 minutes.
1 updated, 0 pushed, 0 ignored
0 errors - 0 update, 0 push.

I am so sorry that language of my Windows is Simplified Chinese. This ERROR means that array is null.

Then I print $Global:Info

PS D:\Project\Chocolatey-Package> $Global:Info |where {($_.Updated -eq $True) -Or ($_.Pushed -eq $True)}

Path          : D:\Project\Chocolatey-Package\cemu
Name          : cemu
Updated       : True
Pushed        : False
RemoteVersion : 1.11.5
NuspecVersion : 1.11.4
Result        : {cemu - checking updates using AU version 2018.1.11, , nuspec version: 1.11.4, remote version: 1.11.5...}
Error         :
NuspecPath    : D:\Project\Chocolatey-Package\cemu\cemu.nuspec
NuspecXml     : #document
Ignored       : False
IgnoreMessage :
StreamsPath   : D:\Project\Chocolatey-Package\cemu\cemu.json
Streams       :

Windows: Windows 10 LSTB
git version: git version 2.16.2.windows.1
Git method: SSH
choco version: v0.10.8

@Thilas
Copy link
Collaborator

Thilas commented Mar 12, 2018

I guess you are talking about your own choco repo on GitHub? Do you have an update_vars.ps1 file next to your update_all.ps1? If you could provide at least an obfuscated one?

@Thilas
Copy link
Collaborator

Thilas commented Mar 12, 2018

I can't manage to reproduce this issue using your choco repo and running update_all.ps1. I'll need some help from you.

@echizenryoma
Copy link
Author

echizenryoma commented Mar 12, 2018

my update_vars.ps1 is like:

# AU Packages Template: https://github.com/majkinetor/au-packages-template
# Copy this file to update_vars.ps1 and set the variables there. Do not include it in the repository.

$Env:au_Push = 'false'

$Env:gist_id = '06bd306e9a1c0a26e8d81fe185ef77d0'
$Env:github_user_repo = 'echizenryoma/Chocolatey-Package'
$Env:github_api_key = 'XXXXXXXXXXXXXXXXXXXX'

$Env:report_path = Join-Path $PSScriptRoot "Update-AUPackages.md"
$Env:history_path = Join-Path $PSScriptRoot "Update-History.md"

@majkinetor
Copy link
Owner

Maybe we should add some verbose messages in git plugin to help @echizenryoma troubleshoot this

@Thilas
Copy link
Collaborator

Thilas commented Mar 12, 2018

I like the idea but I'm not sure where to start with. I don't even see what array could be responsible for this error. The only one I thought about is $packages but it can't be this one according the stats mentionned at the end of the logs. Any idea on your side?

FYI, I can't reproduce the error using @echizenryoma's choco repo.

@echizenryoma
Copy link
Author

echizenryoma commented Mar 12, 2018

If AU don't have any updates, it will not trigger this bug. You should downgrade a package, then run update_all.ps1. For example, edit cemu\cemu.nuspec

<version>1.11.5</version> --> <version>1.11.4</version>

@Thilas
Copy link
Collaborator

Thilas commented Mar 13, 2018

I already tried that but it works anyway.

@echizenryoma
Copy link
Author

echizenryoma commented Mar 13, 2018

I don't know what the problem is. I has tried to new a virtual machine (Windows 2016 Server), but this bug exists anyway. So I am confused now. Please tell me how to print some verbose messages. Thank you for your attention.

@echizenryoma
Copy link
Author

echizenryoma commented Mar 14, 2018

I edit C:\Program Files\WindowsPowerShell\Modules\AU\Plugins\Git.ps1 to:

Write-Host "`$Info: $Info"

[array]$packages = if ($Force) { $Info.result.updated } else { $Info.result.pushed }

Write-Host "`$packages: $packages"

if ($packages.Length -eq 0) { Write-Host "No package updated, skipping"; return }

then run update_all.ps1:

......
[4/49] cemu is updated to 1.11.5 (20.41s)
......

Running Git
$Info: @{result=; error_count=; error_info=; packages=System.Object[]; startTime=03/14/2018 08:42:35; minutes=.95; pushed=0; updated=1; ignored=0; stats=System.Object[]; options=System.Collections.Specialized.OrderedDictionary; plugin_results=System.Collections.Hashtable; plugin_errors=System.Collections.Hashtable}

$packages: AUPackage
  ERROR:
    Cannot index into a null array.

Then I am sure that result is null.

@Thilas
Copy link
Collaborator

Thilas commented Mar 14, 2018

What version of AU are you using? You can get it with this powershell command (Get-Command Update-AUPackages).Version.

@echizenryoma
Copy link
Author

(Get-Command Update-AUPackages).Version

Major  Minor  Build  Revision
-----  -----  -----  --------
2018   1      11     -1

@majkinetor
Copy link
Owner

What happens when you add Force parameter in your update_all

au/AU/Plugins/Git.ps1

Lines 15 to 16 in 39551f8

# Force git commit when package is updated but not pushed.
[switch] $Force,

@echizenryoma
Copy link
Author

echizenryoma commented Mar 17, 2018

I was using Force in my update_all.ps1.

Git           = @{
        Password = $Env:github_api_key
        Force    = $true
    }

@echizenryoma
Copy link
Author

echizenryoma commented Apr 7, 2018

I find if i use SSH method to git, which causes this problem. But I use HTTPs method to git, which is OK.

@majkinetor
Copy link
Owner

#140

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

No branches or pull requests

3 participants