@@ -572,7 +572,9 @@ func InitializeCache() error {
572572 }
573573 pdscXML := xml .NewPdscXML (pdscFilePath )
574574 if err := pdscXML .Read (); err != nil {
575- return fmt .Errorf ("%q: %w" , pdscFilePath , err )
575+ utils .UnsetReadOnly (pdscFilePath )
576+ os .Remove (pdscFilePath )
577+ return fmt .Errorf ("%s: %w, file removed" , pdscFilePath , err )
576578 }
577579 releaseTag := pdscXML .FindReleaseTagByVersion ("" )
578580 cacheTag := xml.PdscTag {
@@ -810,7 +812,7 @@ func UpdateInstalledPDSCFiles(pidxXML, cidxXML *xml.PidxXML, updatePrivatePdsc,
810812 pdscXML := xml .NewPdscXML (pdscFile )
811813 err := pdscXML .Read ()
812814 if err != nil {
813- log .Errorf ("%s : %v" , pdscFile , err )
815+ log .Errorf ("%q : %v, file removed " , pdscFile , err )
814816 utils .UnsetReadOnly (pdscFile )
815817 os .Remove (pdscFile )
816818 continue
@@ -831,7 +833,7 @@ func UpdateInstalledPDSCFiles(pidxXML, cidxXML *xml.PidxXML, updatePrivatePdsc,
831833 pdscXML = xml .NewPdscXML (pdscFile )
832834 err = pdscXML .Read ()
833835 if err != nil {
834- log .Errorf ("%s : %v" , pdscFile , err )
836+ log .Errorf ("%q : %v, file removed " , pdscFile , err )
835837 utils .UnsetReadOnly (pdscFile )
836838 os .Remove (pdscFile )
837839 continue
@@ -1287,7 +1289,9 @@ func ListInstalledPacks(listCached, listPublic, listUpdates, listRequirements, t
12871289 if listRequirements {
12881290 p .Pdsc = xml .NewPdscXML (pack .pdscPath )
12891291 if err := p .Pdsc .Read (); err != nil {
1290- return err
1292+ utils .UnsetReadOnly (pack .pdscPath )
1293+ os .Remove (pack .pdscPath )
1294+ return fmt .Errorf ("%s: %w, file removed" , pack .pdscPath , err )
12911295 }
12921296 if err := p .loadDependencies (false ); err != nil {
12931297 return err
@@ -1417,7 +1421,7 @@ func FindPackURL(pack *PackType, testing bool) (string, error) {
14171421 packPdscXML := xml .NewPdscXML (packPdscFileName )
14181422 if err := packPdscXML .Read (); err != nil {
14191423 if errors .Unwrap (err ) == syscall .ENOENT {
1420- err = fmt .Errorf ("%q : %w" , packPdscFileName , errs .ErrPackPdscCannotBeFound )
1424+ err = fmt .Errorf ("%s : %w" , packPdscFileName , errs .ErrPackPdscCannotBeFound )
14211425 }
14221426 return "" , err
14231427 }
@@ -1445,7 +1449,7 @@ func FindPackURL(pack *PackType, testing bool) (string, error) {
14451449 if err := packPdscXML .Read (); err != nil {
14461450 log .Warnf ("Latest pdsc %q does not exist in public index" , xmlTag .Key ())
14471451 if errors .Unwrap (err ) == syscall .ENOENT {
1448- err = fmt .Errorf ("%q : %w" , packPdscFileName , errs .ErrPackPdscCannotBeFound )
1452+ err = fmt .Errorf ("%s : %w" , packPdscFileName , errs .ErrPackPdscCannotBeFound )
14491453 }
14501454 return "" , err
14511455 }
@@ -2105,7 +2109,7 @@ func (p *PacksInstallationType) downloadPdscFile(pdscTag xml.PdscTag, skipInstal
21052109
21062110 if err != nil {
21072111 // log.Errorf("Could not download %q: %s", pdscFileURL, err)
2108- // return fmt.Errorf("%q : %w", pdscFileURL, errs.ErrPackPdscCannotBeFound)
2112+ // return fmt.Errorf("%s : %w", pdscFileURL, errs.ErrPackPdscCannotBeFound)
21092113 return err
21102114 }
21112115
@@ -2116,7 +2120,9 @@ func (p *PacksInstallationType) downloadPdscFile(pdscTag xml.PdscTag, skipInstal
21162120
21172121 pdscXML := xml .NewPdscXML (pdscFilePath )
21182122 if err := pdscXML .Read (); err != nil {
2119- return fmt .Errorf ("%q: %w" , pdscFilePath , err )
2123+ utils .UnsetReadOnly (pdscFilePath )
2124+ os .Remove (pdscFilePath )
2125+ return fmt .Errorf ("%s: %w, file removed" , pdscFilePath , err )
21202126 }
21212127 releaseTag := pdscXML .FindReleaseTagByVersion ("" )
21222128 cacheTag := xml.PdscTag {
@@ -2193,7 +2199,7 @@ func (p *PacksInstallationType) loadPdscFile(pdscTag xml.PdscTag, timeout int) e
21932199
21942200 if err != nil {
21952201 // log.Errorf("Could not download %q: %s", pdscFileURL, err)
2196- // return fmt.Errorf("%q : %w", pdscFileURL, errs.ErrPackPdscCannotBeFound)
2202+ // return fmt.Errorf("%s : %w", pdscFileURL, errs.ErrPackPdscCannotBeFound)
21972203 return err
21982204 }
21992205
0 commit comments