Recent

Author Topic: rtl/sinclairql/sysutils.pp.FileRead might not return a result  (Read 2847 times)

lagprogramming

  • Full Member
  • ***
  • Posts: 171
rtl/sinclairql/sysutils.pp.FileRead might not return a result
« on: October 18, 2021, 04:17:00 pm »
rtl/sinclairql/sysutils.pp contains the following function:
Code: Pascal  [Select][+][-]
  1. function FileRead(Handle: THandle; out Buffer; Count: LongInt): LongInt;
  2. begin
  3.   if (Count<=0) then
  4.     exit;
  5.  
  6.   { io_fstrg handles EOF }
  7.   FileRead := io_fstrg(Handle, -1, @Buffer, Count);
  8.   if FileRead < 0 then
  9.     FileRead:=-1;
  10. end;
  11.  
   I've looked at other file related functions in the file and it looks like in their case it's guaranteed to return a result.
   When working with subversion we could identify a trunk snapshot by revision number. Also we could download a specific development revision number from the server, anytime. Can we identify a snapshot with git and can we download the same snapshot(revision like) later in time in a simmilar way? All I can say is that the above code is found in a rather recent development snapshot, but I don't know how to precisely identify it.

ccrause

  • Sr. Member
  • ****
  • Posts: 484
Re: rtl/sinclairql/sysutils.pp.FileRead might not return a result
« Reply #1 on: October 18, 2021, 08:48:34 pm »
   When working with subversion we could identify a trunk snapshot by revision number. Also we could download a specific development revision number from the server, anytime. Can we identify a snapshot with git and can we download the same snapshot(revision like) later in time in a simmilar way? All I can say is that the above code is found in a rather recent development snapshot, but I don't know how to precisely identify it.
The commit for the code of interest can be found with git blame, or this view in gitlab.  This shows that the latest changes were applied in commit 02e63411617bcd6f99f666cf341fba063fb47532.  You can view the state of the whole source tree for that particular commit.  When in the files view of this commit there should be a download icon (next to the clone button) to download a snapshot in zip or some other formats.  Or click on this link.

lagprogramming

  • Full Member
  • ***
  • Posts: 171
Re: rtl/sinclairql/sysutils.pp.FileRead might not return a result
« Reply #2 on: October 24, 2021, 09:22:18 am »
   When working with subversion we could identify a trunk snapshot by revision number. Also we could download a specific development revision number from the server, anytime. Can we identify a snapshot with git and can we download the same snapshot(revision like) later in time in a simmilar way? All I can say is that the above code is found in a rather recent development snapshot, but I don't know how to precisely identify it.
The commit for the code of interest can be found with git blame, or this view in gitlab.  This shows that the latest changes were applied in commit 02e63411617bcd6f99f666cf341fba063fb47532.  You can view the state of the whole source tree for that particular commit.  When in the files view of this commit there should be a download icon (next to the clone button) to download a snapshot in zip or some other formats.  Or click on this link.

Let me reformulate. I'm looking for a general approach, not specific for the above function.
After running
Code: Pascal  [Select][+][-]
  1. git clone https://gitlab.com/freepascal.org/fpc/source.git fpc
there is no text that identifies the snapshot(equivalent to revision number in subversion) of the source code. If I send you the above command and you execute it next week you'll download a different source code than the one I've downloaded. Yours will be an updated one. I want to know what is the command that you should run in order to download the exact snapshot(revision in subversion) as I did. There has to be a two step process: identifying the snapshot I've downloaded and passing that snapshot ID as a parameter when you execute git to download the snapshot.
So, how do I identify the snapshot I have downloaded using "git clone https://gitlab.com/freepascal.org/fpc/source.git fpc" and what is the command that you should execute to download the same snapshot, no matter the day when you execute the command?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1699
  • Former Delphi 1-7, 10.2 user
Re: rtl/sinclairql/sysutils.pp.FileRead might not return a result
« Reply #3 on: October 24, 2021, 09:51:08 am »
I'm no git expert, but I think you have a choice of:

Code: [Select]
trev@macmini8 [/usr/local/share/fpcsrc/3.3.1] $ git describe
3.3.1-9458-gc616832792

trev@macmini8 [/usr/local/share/fpcsrc/3.3.1] $ git rev-parse HEAD
c6168327925ff1bc96f06fe9df952b147bf2b8de

trev@macmini8 [/usr/local/share/fpcsrc/3.3.1] $ git rev-parse --short HEAD
c616832792

trev@macmini8 [/usr/local/share/fpcsrc/3.3.1] $ git log -1
commit c6168327925ff1bc96f06fe9df952b147bf2b8de (HEAD -> main, origin/main, origin/HEAD)
Author: Pierre Muller <pierre@...>
Date:   Mon Oct 18 22:41:38 2021 +0000

  Disable utils packages for wasi OS if required package is not supported or if labels are
 used (which is not supported for wasm32 target CPU)

To checkout the same clone at a later date:

Code: [Select]
git clone [remote_repo] my_repo
cd my_repo
git reset --hard c6168327925ff1bc96f06fe9df952b147bf2b8de

Or, with an up to date clone, you could simply re-create it with a new branch:

Code: [Select]
git checkout -b new_branch_name c6168327925ff1bc96f06fe9df952b147bf2b8de
[Edit answer part 2 of question]
« Last Edit: October 24, 2021, 10:02:40 am by trev »
Lazarus 2.3, FPC 3.3.1 macOS 12.0.1 x86_64 Xcode 13.1
Lazarus 2.3, FPC 3.3.1 macOS 12.0.1 aarch64 Xcode 13.1
Lazarus 2.3, FPC 3.2.2 FreeBSD 13.0 amd64 VM
Lazarus 2.3, FPC 3.2.2 FreeBSD 12.2 amd64 VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 VM
Lazarus 2.0.10 FPC 3.2.0 Win10 VM

 

TinyPortal © 2005-2018