I have a library that has been in the Library Manager for some time. I pushed an update (v3.1.0) to GitHub, and in the log, the indexer gives the message "Error syncing library: error checking out repo: failed to get repository to clean state."
I cannot see what might be wrong with the repo. I pushed an update last week (v3.0.0) that worked fine. I have run arduino-lint and it notes the .development file but that is nothing new, and is listed in .gitignore, so it does not get pushed to GitHub.
Hi @jchristensen2. The problem is caused by a mistake that was made when creating this file:
This is not a standard text file, but instead a symlink, which links to a target that consists of the text of all the code you intended to include in the file itself.
$ git clone https://github.com/JChristensen/DS3232RTC
[...]
$ cd DS3232RTC/
$ git checkout 3.1.0
[...]
$ readlink src/GenericRTC.h
// Abtract base class for:
// Arduino DS3232RTC Library https://github.com/JChristensen/DS3232RTC
// and Arduino MCP79412RTC Library // https://github.com/JChristensen/MCP79412RTC
// Copyright (C) 2025 by Jack Christensen and licensed under
// GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html
//
// Allows a sketch to work with either type of RTC, can be determined at run time.
#ifndef GENERIC_RTC_H_INCLUDED
#define GENERIC_RTC_H_INCLUDED
#include <Arduino.h>
#include <TimeLib.h> // https://github.com/PaulStoffregen/Time
#include <Wire.h>
class GenericRTC
{
public:
GenericRTC(TwoWire& tw=Wire) : wire(tw) {};
virtual void begin() = 0;
virtual time_t get() = 0;
virtual uint8_t set(const time_t t) = 0;
virtual uint8_t writeRTC(const uint8_t addr, const uint8_t* values, const uint8_t nBytes) =0;
virtual uint8_t writeRTC(const uint8_t addr, const uint8_t value) = 0;
virtual uint8_t readRTC(const uint8_t addr, uint8_t* values, const uint8_t nBytes) = 0;
virtual uint8_t readRTC(const uint8_t addr) = 0;
protected:
TwoWire& wire; // reference to Wire, Wire1, etc.
};
#endif
The corruption of the symlink occurred here:
--- a/src/GenericRTC.h
+++ b/src/GenericRTC.h
@@ -1 +1,31 @@
-../../MCP79412RTC/src/GenericRTC.h
\ No newline at end of file
+// Abtract base class for:
+// Arduino DS3232RTC Library https://github.com/JChristensen/DS3232RTC
+// and Arduino MCP79412RTC Library // https://github.com/JChristensen/MCP79412RTC
+// Copyright (C) 2025 by Jack Christensen and licensed under
+// GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html
+//
+// Allows a sketch to work with either type of RTC, determined at run time.
+
+#ifndef GENERIC_RTC_H_INCLUDED
+#define GENERIC_RTC_H_INCLUDED
+
+#include <Arduino.h>
+#include <TimeLib.h> // https://github.com/PaulStoffregen/Time
+#include <Wire.h>
+
+class GenericRTC
+{
+ public:
+ GenericRTC(TwoWire& tw=Wire) : wire(tw) {};
+ virtual void begin() = 0;
+ virtual time_t get() = 0;
+ virtual uint8_t set(const time_t t) = 0;
+ virtual uint8_t writeRTC(const uint8_t addr, const uint8_t* values, const uint8_t nBytes) =0;
+ virtual uint8_t writeRTC(const uint8_t addr, const uint8_t value) = 0;
+ virtual uint8_t readRTC(const uint8_t addr, uint8_t* values, const uint8_t nBytes) = 0;
+ virtual uint8_t readRTC(const uint8_t addr) = 0;
+
+ protected:
+ TwoWire& wire; // reference to Wire, Wire1, etc.
+};
+#endif
However, even before that corruption, the use of a symlink would be problematic as library releases that contain symlinks are not accepted in Library Manager. Even with a manual installation this is unfriendly to Windows users, since symlinks are disabled in Windows by default.
So the solution will be to replace the symlink with a normal file containing that code. I submitted a pull request for the necessary change:
After that fix, you will also need to make a new release of the library. The indexer system will still be unable to process the existing 3.1.0 release, but that isn't actually a problem because the presence of the symlink would have caused that release to be rejected anyway. It should be able to process the new release, and add it to the Library Manager index (assuming the release meets all the requirements for inclusion).
Hi @ptillisch, indeed at one point I had created that file as a symlink and mistakenly did a push (I do understand that symlinks are not allowed.) I caught that, and I am pretty sure that when I pushed 3.1.0, the file on my machine was no longer a symlink (it is not now.) But I see that it still is a symlink on GitHub. I had missed that, but I am still somewhat puzzled as to why that is.
Many thanks for the PR and the detailed explanation.
I ran into something like this myself when I was preparing the PR. I initially simply deleted the symlink, added a normal file with the code, then tried to commit the change. But there was no diff to commit. It seems that Git didn't recognize that the file was changed from a symlink to a normal file. I suspect this happened because I did it on a Windows machine (where I don't have implicit symbolic link support enabled because I try to keep my system as "vanilla" as possible in order to most closely replicate the environment of the users I support). I just tried doing the same on a Linux machine and I got the expected diff.
So on the Windows machine, Git recognized changes to the content of the file (which in my case were no changes at all), but it does not change the file mode from 120000 (symlink).
You are welcome. I'm glad if I was able to be of assistance.
What you experienced on Windows sounds pretty similar to what happened here on Linux. Pretty sure I did a push when the file was not a symlink on my disk.
Now I removed the file, did a commit, pushed it, then added the file back, then another commit and push. It looks OK on GitHub now, so fingers crossed.