Repository: KLayout/klayout (language: python)

Issue:
MAGIC import fails
![image](https://github.com/user-attachments/assets/9bb1cecf-8224-482a-b2be-e7ba7dc7ba10)

The cursor here shows the line 337:
![Bildschirmfoto 2024-11-15 um 17 12 45](https://github.com/user-attachments/assets/b0ddfd43-28de-4e86-9e93-f5ad95731522)

Reduced:
[redux.mag.zip](https://github.com/user-attachments/files/17778185/redux.mag.zip)

Seems the `s` is optional, if I remove it the import works:
[redux-workaround.mag.zip](https://github.com/user-attachments/files/17778202/redux-workaround.mag.zip)



Discussion / hints:
I found the reader code in Magic. "s" is optional and goes into some "stickyflag" 1-character string. But I do not see anything done with it, so I assume it's a legacy thing.

I will ignore the "s" for now.

Matthias

Fix patch:
diff --git a/src/plugins/streamers/magic/db_plugin/dbMAGReader.cc b/src/plugins/streamers/magic/db_plugin/dbMAGReader.cc
index 05841c10e7..f019d32a1f 100644
--- a/src/plugins/streamers/magic/db_plugin/dbMAGReader.cc
+++ b/src/plugins/streamers/magic/db_plugin/dbMAGReader.cc
@@ -531,6 +531,9 @@ MAGReader::read_rlabel (tl::Extractor &ex, Layout &layout, cell_index_type cell_
   std::string lname;
   ex.read (lname);
 
+  //  skip sticky flag (optional)
+  ex.test ("s");
+
   double l, b, r, t;
   ex.read (l);
   ex.read (b);


Test patch:
diff --git a/src/plugins/streamers/magic/unit_tests/dbMAGReader.cc b/src/plugins/streamers/magic/unit_tests/dbMAGReader.cc
index 53bab88327..d3ad210188 100644
--- a/src/plugins/streamers/magic/unit_tests/dbMAGReader.cc
+++ b/src/plugins/streamers/magic/unit_tests/dbMAGReader.cc
@@ -156,3 +156,8 @@ TEST(3)
   run_test (_this, tl::testdata (), "ringo/RINGO.mag", "ringo_au.cif.gz");
 }
 
+TEST(4)
+{
+  run_test (_this, tl::testdata (), "issue_1925/redux.mag", "redux_au.cif.gz");
+}
+
diff --git a/testdata/magic/issue_1925/redux.mag b/testdata/magic/issue_1925/redux.mag
new file mode 100644
index 0000000000..4f1d451d91
--- /dev/null
+++ b/testdata/magic/issue_1925/redux.mag
@@ -0,0 +1,9 @@
+magic
+tech sky130A
+timestamp 1731684784
+<< metal4 >>
+rect 0 0 10000 100
+<< labels >>
+rlabel metal4 s 10500 -9100 10600 12800 6 vccd1
+port 1 nsew power input
+<< end >>
diff --git a/testdata/magic/redux_au.cif.gz b/testdata/magic/redux_au.cif.gz
new file mode 100644
index 0000000000..14bbcd457a
Binary files /dev/null and b/testdata/magic/redux_au.cif.gz differ