Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatsort 1.5.tbd #1048

Merged
merged 4 commits into from
Dec 27, 2023
Merged

fatsort 1.5.tbd #1048

merged 4 commits into from
Dec 27, 2023

Conversation

ltpitt
Copy link
Contributor

@ltpitt ltpitt commented Dec 7, 2023

The support for PowerPC seems to be dropped for this useful tool. I went to sourceforge and compiled all the versions until I found the last one working on my Mac Os X Leopard and tested the install successfully.

@mistydemeo
Copy link
Owner

Thank you!

It looks like this commit is empty; can you double check that you committed the changes you intended?

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 7, 2023

@mistydemeo
Thank you for the magnificent work you do on tigerbrew!

Sorry, I made some error, I hope you can see the change now.

@mistydemeo
Copy link
Owner

All good! Thanks for the quick response; I'll try to test this soon.

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 7, 2023

This was tested on eMac with leopard, I also have a g3 imac with tiger, I will also test tomorrow hopefully.

Have a good one!

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 8, 2023

Here I am, back with my iMac g3 test!
Spoiler alert: bad news :(

Here's running the formula using current version of tigerbrew:

imac:/usr/local/Library/Homebrew$ brew install fatsort
==> Installing dependencies for fatsort: xz, help2man
==> Installing fatsort dependency: xz
==> Downloading https://fossies.org/linux/misc/xz-5.4.4.tar.gz
######################################################################### 100.0%
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/xz/5.4.4
==> make install

/usr/local/Cellar/xz/5.4.4: 127 files, 2.8M, built in 8.5 minutes
==> Installing fatsort dependency: help2man
==> Downloading http://ftpmirror.gnu.org/help2man/help2man-1.47.2.tar.xz
==> Downloading from http://ftp.snt.utwente.nl/pub/software/gnu/help2man/help2ma
######################################################################### 100.0%
==> ./configure --prefix=/usr/local/Cellar/help2man/1.47.2
==> make install
/usr/local/Cellar/help2man/1.47.2: 8 files, 128K, built in 18 seconds
==> Installing fatsort
==> Downloading https://downloads.sourceforge.net/project/fatsort/fatsort-1.3.36
-=#=#   #   #
curl: (22) The requested URL returned error: 404 Not Found
Error: Failed to download resource "fatsort"
Download failed: https://downloads.sourceforge.net/project/fatsort/fatsort-1.3.365.tar.gz

And here's running it with my patch:

davidenastri@imac:/usr/local/Library/Formula$ brew install fatsort
==> Downloading https://sourceforge.net/code-snapshots/svn/f/fa/fatsort/code/fat
#=#=-#  #
curl: (22) The requested URL returned error: 404 Not Found
Error: Failed to download resource "fatsort"
Download failed: https://sourceforge.net/code-snapshots/svn/f/fa/fatsort/code/fatsort-code-r522-trunk.zip

Bad news indeed :(

I started digging and found out the root cause, seems like sourceforge is creating those code-snapshots for previous versions by user request from the site and deleting them quickly. It makes sense but it is a bummer for us.

If you go on this page:
https://sourceforge.net/p/fatsort/code/522/tree/
And hit the "Download snapshot button" a couple of times then the file is there and the formula works until...
Next clean-up.

A side effect of this kung-fu is obvisouly sha changing:

imac:/usr/local/Library/Formula$ brew install fatsort
==> Downloading https://sourceforge.net/code-snapshots/svn/f/fa/fatsort/code/fatsort-code-r522-trunk.zip
################################################################################################################################### 100.0%
Error: SHA256 mismatch
Expected: 341ab8b9dc04b53d47abcb282c7cb027a2bae982e1ded3083d62aa7c260a1bde
Actual: 06bfb27d37a3f4ea72b69bc13bf7db6f43621e71602fc359afd378cf8901b368
Archive: /Users/xxx/Library/Caches/Homebrew/fatsort-code.zip
To retry an incomplete download, remove the file above.

If I fix that manually and try again seems like we have even more issues on Tiger that caused no problem on Leopard, marvelous:

davidenastri@imac:/usr/local/Library/Formula$ nano fatsort.rb
davidenastri@imac:/usr/local/Library/Formula$ brew install fatsort
==> Downloading https://sourceforge.net/code-snapshots/svn/f/fa/fatsort/code/fatsort-code-r522-trunk.zip
Already downloaded: /Users/davidenastri/Library/Caches/Homebrew/fatsort-code.zip
==> make CC=/usr/local/bin/gcc-4.2
Last 15 lines from /Users/davidenastri/Library/Logs/Homebrew/fatsort/01.make:
2023-12-08 13:43:38 +0100

make
CC=/usr/local/bin/gcc-4.2

make -C src/
uname: illegal option -- o
usage: uname [-amnprsv]
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D __OSX__ -c fatsort.c -o fatsort.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D __OSX__ -c FAT_fs.c -o FAT_fs.o
In file included from FAT_fs.c:25:
FAT_fs.h:237: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘getClusterOffset’
make[1]: *** [FAT_fs.o] Error 1
make: *** [src] Error 2

READ THIS: https://github.com/mistydemeo/tigerbrew/wiki/troubleshooting

These open issues may also help:
fatsort 1.5.tbd https://github.com/mistydemeo/tigerbrew/pull/1048

So it seems like two obstacles are in our way:

  1. Making the ppc compatible fatsort 522 version available constantly
  2. Fix the issue on Tiger

For the first one maybe I create a dedicated repo here on Github containing the needed archive and update the formula again?
For the last one I will investigate and understand if I can fix it.
I would also be very happy to make the last version of fatsort working on ppc but that seems to be a task needing a more violent fighter.
Nonetheless I will give it a go.

Sorry, I should have tested better, I have learned a lesson.

Please feel free to close this merge request if you need to.

@sevan
Copy link
Contributor

sevan commented Dec 8, 2023

Looking at the tagged releases), r522 falls between 1.5.0.456 & 1.6.0.555. As a compromise, package 1.5.0.456 if you can find a copy of the source archive? (since project has carrying copies of its previous releases).

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 8, 2023

Thanks for helping, @sevan !

Please forgive my Sourceforge ignorance but what I tried is taking the url of the most recent version and putting in the one you suggested:
https://sourceforge.net/projects/fatsort/files/fatsort-1.5.0.456.tar.xz/download?use_mirror=deac-ams&download=&failedmirror=deac-riga.dl.sourceforge.net

But that won't work.
Is this what you were suggesting?

@sevan
Copy link
Contributor

sevan commented Dec 8, 2023

Almost, it seems that the FATsort project only hosts the source archives for the 2 most recent releases in the Sourceforge files section of the project, but in the past, folks must've packaged the previous releases at the time, so you might be able to find a copy of fatsort-1.5.0.456.tar.xz at another mirror hosted elsewhere from Sourceforge (use a search engine to see what results you get).
Another option is to use the Wayback machine to pull a copy of fatsort-1.5.0.456.tar.xz from the files section of the Sourceforge page in the past.

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 8, 2023

@sevan
Excellent point!
I found one mirror and updated the PR.

Will now start G3 and G4 and test from there to be sure.

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 8, 2023

Good-ish news.

The G4 works like a champ:

emac:~ Mac$ brew install fatsort
==> Downloading https://mirrors.aliyun.com/macports/distfiles/fatsort/fatsort-1.
######################################################################### 100.0%
==> make CC=gcc-4.2
/usr/local/Cellar/fatsort/1.5.0.456: 6 files, 92K, built in 58 seconds
emac:~ Mac$

The G3 downloads also fine but, sadly, cannot compile (but that's a different topic):

imac:/usr/local/Library/Formula$ brew install fatsort
==> Downloading https://mirrors.aliyun.com/macports/distfiles/fatsort/fat
################################################################## 100.0%
==> make CC=/usr/local/bin/gcc-4.2
Last 15 lines from /Users/davidenastri/Library/Logs/Homebrew/fatsort/01.make:
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c entrylist.c -o entrylist.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c errors.c -o errors.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c options.c -o options.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c clusterchain.c -o clusterchain.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c sort.c -o sort.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c misc.c -o misc.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c natstrcmp.c -o natstrcmp.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c stringlist.c -o stringlist.o
/usr/local/bin/gcc-4.2 -Os -w -pipe -mcpu=750 -faltivec -mmacosx-version-min=10.4 -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c regexlist.c -o regexlist.o
gcc -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -s -liconv fatsort.o FAT_fs.o fileio.o endianness.o signal.o entrylist.o errors.o options.o clusterchain.o sort.o misc.o natstrcmp.o stringlist.o regexlist.o  -o fatsort
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
___floatundisf
collect2: ld returned 1 exit status
make[1]: *** [fatsort] Error 1
make: *** [src] Error 2

READ THIS: https://github.com/mistydemeo/tigerbrew/wiki/troubleshooting

These open issues may also help:
fatsort 1.5.tbd https://github.com/mistydemeo/tigerbrew/pull/1048

I think it is an improvement over current status on master branch but I am open for any suggestion.

@sevan
Copy link
Contributor

sevan commented Dec 8, 2023

On your G3, do you get the same issue if use GCC 4.0.1?
brew install fatsort --cc=gcc-4.0

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 10, 2023

Worked like a doll!

==> make CC=/usr/bin/gcc-4.0
/usr/local/Cellar/fatsort/1.5.0.456: 6 files, 96K, built in 21 seconds

I wonder why this does not happen on the G4...
Weird.

@sevan
Copy link
Contributor

sevan commented Dec 10, 2023

Cool, uninstall it & try once again as you were with the GCC 4.2 compiler, but this time turn off optimisation by adding ENV.no_optimization on a new line after the def install line.
Are you still able to compile it on your G3?

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 10, 2023

I tried on G3:
brew uninstall fatsort

then I added ENV.no_optimization:

class Fatsort < Formula
  desc "Sorts FAT16 and FAT32 partitions"
  homepage "http://fatsort.sourceforge.net/"
  url "https://mirrors.aliyun.com/macports/distfiles/fatsort/fatsort-1.5.0.456.tar.xz"
  sha256 "a835b47814fd30d5bad464b839e9fc404bc1a6f5a5b1f6ed760ce9744915de95"

  depends_on "help2man"

  def install
    ENV.no_optimization
    system "make", "CC=#{ENV.cc}"
    bin.install "src/fatsort"
    man1.install "man/fatsort.1"
  end
end

and tried brew install fatsort again but:

/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c entrylist.c -o entrylist.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c errors.c -o errors.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c options.c -o options.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c clusterchain.c -o clusterchain.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c sort.c -o sort.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c misc.c -o misc.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c natstrcmp.c -o natstrcmp.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c stringlist.c -o stringlist.o
/usr/local/bin/gcc-4.2 -w -pipe -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c regexlist.c -o regexlist.o
gcc -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -s -liconv fatsort.o FAT_fs.o fileio.o endianness.o signal.o entrylist.o errors.o options.o clusterchain.o sort.o misc.o natstrcmp.o stringlist.o regexlist.o  -o fatsort
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
___floatundisf
collect2: ld returned 1 exit status
make[1]: *** [fatsort] Error 1
make: *** [src] Error 2

READ THIS: https://github.com/mistydemeo/tigerbrew/wiki/troubleshooting

These open issues may also help:
fatsort 1.5.tbd https://github.com/mistydemeo/tigerbrew/pull/1048

@sevan
Copy link
Contributor

sevan commented Dec 10, 2023

Got it, you're using 2 different compilers due to the makefile.
Replace the line system "make", "CC=#{ENV.cc}" with system "make", "CC=#{ENV.cc}", "LD=#{ENV.cc}" and try again.
You can drop the ENV.no_optimization change but it wont harm if you left it in.

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 10, 2023

Genius!

imac:/usr/local/Library/Formula$ brew install fatsort
==> Downloading https://mirrors.aliyun.com/macports/distfiles/fatsort/fatsort-1.5.0.456.tar.xz
Already downloaded: /Users/davidenastri/Library/Caches/Homebrew/fatsort-1.5.0.456.tar.xz
==> make CC=/usr/local/bin/gcc-4.2 LD=/usr/local/bin/gcc-4.2
/usr/local/Cellar/fatsort/1.5.0.456: 6 files, 108K, built in 18 seconds

emac:/usr/local/Library/Formula$brew install fatsort
==> Downloading https://mirrors.aliyun.com/macports/distfiles/fatsort/fatsort-1.
Already downloaded: /Users/Mac/Library/Caches/Homebrew/fatsort-1.5.0.456.tar.xz
==> make CC=gcc-4.2 LD=gcc-4.2
/usr/local/Cellar/fatsort/1.5.0.456: 6 files, 92K, built in 10 seconds

Both system were tested using:
brew uninstall fatsort
brew install fatsort

I made sure to update also my pull request to reflect the file used on both machines.

Is this victory? :D

@sevan
Copy link
Contributor

sevan commented Dec 10, 2023

Yes. :)

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 10, 2023

Deeply thanks for your help, I would have simply never made it without it!

Have a great day @sevan :)

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 10, 2023

Maybe to make it tidier I could squash commits?

@sevan
Copy link
Contributor

sevan commented Dec 10, 2023

Sounds good.

@ltpitt
Copy link
Contributor Author

ltpitt commented Dec 10, 2023

Seems like GitHub does it automatically at merge time if you choose to do so.

Neat!

Copy link
Owner

@mistydemeo mistydemeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Finally had the time to test.

@mistydemeo mistydemeo merged commit 3b94c14 into mistydemeo:master Dec 27, 2023
@ltpitt ltpitt deleted the patch-2 branch December 27, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants