# Pijul clone https://nest.pijul.com/pijul\_org/pijul is not working?

**URL:** <https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52>\
**Category:** Question\
**Created:** [July 12, 2017, 1:36am UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52 "2017-07-12T01:36:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 12, 2017, 1:36am UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/1 "2017-07-12T01:36:36Z")

</div>

I’m trying to clone the pijul’s repository, but the command is awaiting something, and don’t download patches neither finish the command. The command is:

pijul clone [https://nest.pijul.com/pijul\_org/pijul](https://nest.pijul.com/pijul_org/pijul)

---

<div class="post-metadata">

**Author:** ![lthms](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/lthms/32/124_2.png) [@lthms](https://discourse.pijul.org/u/lthms)\
**Post date:** [July 12, 2017, 5:15pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/2 "2017-07-12T17:15:01Z")

</div>

Which version of `pijul` are you using? Is it up-to-date?

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 12, 2017, 6:14pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/3 "2017-07-12T18:14:11Z")

</div>

It’s version 0.6.1. Installed yesterday in an recently formatted computer, with **cargo install pijul**

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 12, 2017, 7:05pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/4 "2017-07-12T19:05:42Z")

</div>

P.D. I’m in Windows 10 64 bits

---

<div class="post-metadata">

**Author:** ![lthms](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/lthms/32/124_2.png) [@lthms](https://discourse.pijul.org/u/lthms)\
**Post date:** [July 12, 2017, 8:05pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/5 "2017-07-12T20:05:01Z")

</div>

I never tried `pijul` on Windows :x sorry. But @pmeunier may be able to help you!

---

<div class="post-metadata">

**Author:** ![laumann](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/laumann/32/8_2.png) [@laumann](https://discourse.pijul.org/u/laumann)\
**Post date:** [July 14, 2017, 12:14am UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/6 "2017-07-14T00:14:56Z")

</div>

I just tried cloning through https with no problem. Have you tried with some debugging info, a la

```
$ RUST_LOG=pijul pijul clone https://nest.pijul.com/pijul_org/pijul

```

?

It took ~100 seconds for me (I’m on a slow connection right now, so I’m pretty sure that’s a factor).

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 14, 2017, 4:25am UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/7 "2017-07-14T04:25:34Z")

</div>

To me, is not finishing after 30 mins. In Visual Studio Debugger, i can see that the program is stopped in line 103 in **.cargo\registry\src\github.com-1ecc6299db9ec823\fs2-0.4.2\src\[windows.rs](http://windows.rs)**;The line contains:

let ret = kernel32::LockFileEx(file.as\_raw\_handle(), flags, 0, !0, !0, &mut overlapped);

The stack trace is:

```
ntdll.dll!NtLockFile()	Desconocido
KernelBase.dll!LockFileEx()	Desconocido
pijul.exe!fs2::windows::lock_file(std::fs::File * file, unsigned int flags) Línea 103	Desconocido
pijul.exe!fs2::windows::lock_exclusive(std::fs::File * file) Línea 79	Desconocido
pijul.exe!fs2::{{impl}}::lock_exclusive(std::fs::File * self) Línea 105	Desconocido
pijul.exe!sanakirja::transaction::{{impl}}::commit(sanakirja::transaction::MutTxn<()> self) Línea 714	Desconocido
pijul.exe!libpijul::backend::T<sanakirja::transaction::MutTxn<()>, rand::ThreadRng>::commit<rand::ThreadRng>() Línea 1311	Desconocido
pijul.exe!pijul::commands::create_repo(std::path::Path * dir) Línea 130	Desconocido
pijul.exe!pijul::commands::clone::run(clap::args::arg_matches::ArgMatches * args) Línea 101	Desconocido
pijul.exe!pijul::main() Línea 63	Desconocido
pijul.exe!panic_unwind::__rust_maybe_catch_panic() Línea 98	Desconocido
pijul.exe!std::rt::lang_start() Línea 51	Desconocido
pijul.exe!main()	Desconocido
[Marco flotante] pijul.exe!invoke_main() Línea 64	C++
pijul.exe!__scrt_common_main_seh() Línea 253	C++
kernel32.dll!00007ffc5aa52774()	Desconocido
ntdll.dll!RtlUserThreadStart()	Desconocido
```

---

<div class="post-metadata">

**Author:** ![laumann](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/laumann/32/8_2.png) [@laumann](https://discourse.pijul.org/u/laumann)\
**Post date:** [July 14, 2017, 5:03am UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/8 "2017-07-14T05:03:44Z")

</div>

Ouch, that definitely Windows land - maybe a bug in [fs2](https://crates.io/crates/fs2) in the call to `lock_exclusive()`? It’s called from sanakirja in [transaction.rs](https://nest.pijul.com/pijul_org/sanakirja/ffb6879b990741e48213) and is this line (714):

```auto
self.env.lock_file.lock_exclusive().unwrap();

```

I’m afraid I can’t help you with a test, as I’m on Linux myself, but maybe write a small program that uses fs2, create a `File` and call `lock_exclusive()` on it? If that works, then we might be looking at a bug in Sanakirja, but if not then it seems likely to be a problem in fs2.

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [July 14, 2017, 5:51am UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/9 "2017-07-14T05:51:18Z")

</div>

I’m really not sure what’s going on there. What file system are you working on?

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 14, 2017, 1:33pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/10 "2017-07-14T13:33:41Z")

</div>

My file system is NTFS. I’ll try later if the problem is in lock\_exclusive, as @laumann suggested.

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 15, 2017, 6:11pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/11 "2017-07-15T18:11:55Z")

</div>

I can confirm that this litte program runs suscessfully in my machine:

```
let mut contentFile= String::new();
let mut file=File::open("E:/tmp/1364560.csv").unwrap();
file.lock_exclusive();
file.read_to_string(&mut contentFile).unwrap();
print!("Contenido del archivo: {}", contentFile);

```

In my machine, lock\_exclusive works ok. But pijul is waiting something. Including pijul 0.7.0. I think, lock\_exclusive is invoked twice on the same file from sanakirja maybe, and the second time, pijul is waiting for the lock.

For reference, LockFileEx is called from lock\_exclusive and can wait for unbounded time:

> **[LockFileEx function (fileapi.h) - Win32 apps](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-lockfileex?redirectedfrom=MSDN)**
>
> Locks the specified file for exclusive access by the calling process. This function can operate either synchronously or asynchronously and can request either an exclusive or a shared lock.

> If the file handle was not opened for asynchronous I/O and the lock is not available, this call waits until the lock is granted or an error occurs

---

<div class="post-metadata">

**Author:** ![wkornewald](https://avatars.discourse-cdn.com/v4/letter/w/3d9bf3/32.png) [@wkornewald](https://discourse.pijul.org/u/wkornewald)\
**Post date:** [July 15, 2017, 11:21pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/12 "2017-07-15T23:21:52Z")

</div>

When I try to clone the official repo on Windows 10 I get a stack overflow exception. Here’s the log:

> **[Dropbox - Link not found](https://www.dropbox.com/s/pvp45nvzg12knc6/pijul.log?dl=0)**
>
> Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily. Never email yourself a file again!

Please let me know if you need anything else.

---

<div class="post-metadata">

**Author:** ![laumann](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/laumann/32/8_2.png) [@laumann](https://discourse.pijul.org/u/laumann)\
**Post date:** [July 16, 2017, 12:28pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/13 "2017-07-16T12:28:27Z")

</div>

> [@gabomgp](#):
>
> In my machine, lock\_exclusive works ok. But pijul is waiting something. Including pijul 0.7.0. I think, lock\_exclusive is invoked twice on the same file from sanakirja maybe, and the second time, pijul is waiting for the lock.
> 
> For reference, LockFileEx is called from lock\_exclusive and can wait for unbounded time:

Is it not re-entrant? What happens if you make two calls to `file.lock_exclusive()`?

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 17, 2017, 2:04pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/14 "2017-07-17T14:04:14Z")

</div>

I can confirm lock\_exclusive is not reentrant. When i make two calls to **file.lock\_exlusive** , the second call is waiting to get the lock, and never gets the lock. The thread is suspended and the program doesn’t advance. With the debugger, in pijul, i can see the stack trace the first time that lock\_exclusive is called is:

```
pijul.exe!fs2::windows::lock_file(std::fs::File * file, unsigned int flags) Línea 103	Desconocido
pijul.exe!fs2::windows::lock_exclusive(std::fs::File * file) Línea 79	Desconocido
pijul.exe!fs2::{{impl}}::lock_exclusive(std::fs::File * self) Línea 105	Desconocido
pijul.exe!sanakirja::transaction::Env::new<&std::path::PathBuf>(unsigned __int64 path) Línea 225	Desconocido
pijul.exe!libpijul::backend::Repository::open<&std::path::PathBuf>(core::option::Option<u64> path) Línea 1214	Desconocido
pijul.exe!pijul::commands::create_repo(std::path::Path * dir) Línea 129	Desconocido
pijul.exe!pijul::commands::clone::run(clap::args::arg_matches::ArgMatches * args) Línea 101	Desconocido
pijul.exe!pijul::main() Línea 80	Desconocido
pijul.exe!panic_unwind::__rust_maybe_catch_panic() Línea 98	Desconocido
pijul.exe!std::rt::lang_start() Línea 51	Desconocido
pijul.exe!main()	Desconocido
[Marco flotante] pijul.exe!invoke_main() Línea 64	C++
pijul.exe!__scrt_common_main_seh() Línea 253	C++
kernel32.dll!BaseThreadInitThunk()	Desconocido
ntdll.dll!RtlUserThreadStart()	Desconocido

```

This stack trace is diferent from the stack trace of the second call. I put the stack trace of the second call here:

```
pijul.exe!fs2::windows::lock_file(std::fs::File * file, unsigned int flags) Línea 103	Desconocido
pijul.exe!fs2::windows::lock_exclusive(std::fs::File * file) Línea 79	Desconocido
pijul.exe!fs2::{{impl}}::lock_exclusive(std::fs::File * self) Línea 105	Desconocido
pijul.exe!sanakirja::transaction::{{impl}}::commit(sanakirja::transaction::MutTxn<()> self) Línea 714	Desconocido
pijul.exe!libpijul::backend::T<sanakirja::transaction::MutTxn<()>, rand::ThreadRng>::commit<rand::ThreadRng>() Línea 1377	Desconocido
pijul.exe!pijul::commands::create_repo(std::path::Path * dir) Línea 130	Desconocido
pijul.exe!pijul::commands::clone::run(clap::args::arg_matches::ArgMatches * args) Línea 101	Desconocido
pijul.exe!pijul::main() Línea 80	Desconocido
pijul.exe!panic_unwind::__rust_maybe_catch_panic() Línea 98	Desconocido
pijul.exe!std::rt::lang_start() Línea 51	Desconocido
pijul.exe!main()	Desconocido
[Marco flotante] pijul.exe!invoke_main() Línea 64	C++
pijul.exe!__scrt_common_main_seh() Línea 253	C++
kernel32.dll!BaseThreadInitThunk()	Desconocido
ntdll.dll!RtlUserThreadStart()	Desconocido

```

@laumann, can i help with more information?

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 19, 2017, 1:42am UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/15 "2017-07-19T01:42:10Z")

</div>

I think lines 713-714 and 732-733 can be simply deleted from **[transaction.rs](http://transaction.rs)** in Sanakirja

I think: This lines locks and unlocks the file to commit the change, but the file lock is already taken, because methods new and Drop in Env locks and unlocks the file too. Can i submit a patch deleting those lines?

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [July 19, 2017, 12:16pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/16 "2017-07-19T12:16:28Z")

</div>

You’re right. These lines are supposed to implement a cool feature of Sanakirja (immutable transactions running concurrently with a single mutable transaction), but need to be removed until that feature is fully implemented.

Thanks for tracking down the issue, it worked on my version of windows, and on linux. I’ll release a new Sanakirja now (0.8.10).

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [July 19, 2017, 12:19pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/17 "2017-07-19T12:19:52Z")

</div>

Done! Thanks! I believe Pijul install should be using the new Sanakirja right away, please come back here if that is not the case.

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 19, 2017, 1:09pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/18 "2017-07-19T13:09:40Z")

</div>

Thanks for the explanation… but, now pijul is crashing with the error:

thread ‘main’ panicked at ‘called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 158, message: “El segmento ya está desbloqueado.” } }’, src\libcore\[result.rs:859](http://result.rs:859)  
stack backtrace:

pijul don’t show me the stack trace in console with **set RUST\_BACKTRACE=1**

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [July 19, 2017, 1:21pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/19 "2017-07-19T13:21:04Z")

</div>

Wow, sorry about that, I just uploaded a new version (0.8.12), which should fix it. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![gabomgp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/gabomgp/32/57_2.png) [@gabomgp](https://discourse.pijul.org/u/gabomgp)\
**Post date:** [July 19, 2017, 2:05pm UTC](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52/20 "2017-07-19T14:05:23Z")

</div>

It works!!! I cloned the pijul repository sucessfully!

[Next page](https://discourse.pijul.org/t/pijul-clone-https-nest-pijul-com-pijul-org-pijul-is-not-working/52.md?page=2)
