Public bug reported:

### Steps To Reproduce

```
sage:fricas('3')
```

### Expected Behavior
```
3
```

### Actual Behavior

```
sage: fricas(3)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
File ~/sage/src/sage/interfaces/expect.py:1519, in ExpectElement.__init__(self, 
parent, value, is_name, name)
   1518 try:
-> 1519     self._name = parent._create(value, name=name)
   1520 # Convert ValueError and RuntimeError to TypeError for
   1521 # coercion to work properly.

File ~/sage/src/sage/interfaces/interface.py:520, in Interface._create(self, 
value, name)
    519 name = self._next_var_name() if name is None else name
--> 520 self.set(name, value)
    521 return name

File ~/sage/src/sage/interfaces/fricas.py:681, in FriCAS.set(self, var, value)
    680 output = self.eval(cmd, reformat=False)
--> 681 self._check_errors(value, output)

File ~/sage/src/sage/interfaces/fricas.py:574, in FriCAS._check_errors(self, 
line, output)
    573         output = output.replace(old, new)
--> 574     raise RuntimeError("An error occurred when FriCAS evaluated 
'%s':\n%s" % (line, output))
    576 # or even an error

RuntimeError: An error occurred when FriCAS evaluated '3':
   Function declaration sageprint : InputForm -> String has been added to
      workspace.


During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 fricas(Integer(3))

File ~/sage/src/sage/misc/lazy_import.pyx:397, in 
sage.misc.lazy_import.LazyImport.__call__()
    395         True
    396     """
--> 397     return self.get_object()(*args, **kwds)
    398
    399 def __repr__(self):

File ~/sage/src/sage/interfaces/interface.py:306, in Interface.__call__(self, 
x, name)
    299     return cls(self, x, name=name)
    300 try:
    301     # Special methods do not and should not have an option to
    302     # set the name directly, as the identifier assigned by the
    303     # interface should stay consistent. An identifier with a
    304     # user-assigned name might change its value, so we return a
    305     # new element.
--> 306     result = self._coerce_from_special_method(x)
    307     return result if name is None else result.name(new_name=name)
    308 except TypeError:

File ~/sage/src/sage/interfaces/interface.py:334, in 
Interface._coerce_from_special_method(self, x)
    332     s = '_gp_'
    333 try:
--> 334     return (x.__getattribute__(s))(self)
    335 except AttributeError:
    336     return self(x._interface_init_())

File ~/sage/src/sage/structure/sage_object.pyx:793, in 
sage.structure.sage_object.SageObject._fricas_()
    791         import sage.interfaces.fricas
    792         G = sage.interfaces.fricas.fricas
--> 793     return self._interface_(G)
    794
    795 def _fricas_init_(self):

File ~/sage/src/sage/structure/sage_object.pyx:723, in 
sage.structure.sage_object.SageObject._interface_()
    721     except Exception:
    722         raise NotImplementedError("coercion of object %s to %s not 
implemented" % (repr(self), I))
--> 723 X = I(s)
    724 if c:
    725     try:

File ~/sage/src/sage/interfaces/interface.py:299, in Interface.__call__(self, 
x, name)
    296         pass
    298 if isinstance(x, str):
--> 299     return cls(self, x, name=name)
    300 try:
    301     # Special methods do not and should not have an option to
    302     # set the name directly, as the identifier assigned by the
    303     # interface should stay consistent. An identifier with a
    304     # user-assigned name might change its value, so we return a
    305     # new element.
    306     result = self._coerce_from_special_method(x)

File ~/sage/src/sage/interfaces/expect.py:1524, in ExpectElement.__init__(self, 
parent, value, is_name, name)
   1522 except (RuntimeError, ValueError) as x:
   1523     self._session_number = -1
-> 1524     raise TypeError(*x.args)
   1525 except BaseException:
   1526     self._session_number = -1

TypeError: An error occurred when FriCAS evaluated '3':
   Function declaration sageprint : InputForm -> String has been added to
      workspace.

sage: fricas(3)
<repr(<sage.interfaces.fricas.FriCASElement at 0x73b6eae59350>) failed: 
AttributeError: 'NoneType' object has no attribute 'rstrip'>
sage:  fricas(3)
<repr(<sage.interfaces.fricas.FriCASElement at 0x73b6ea563610>) failed: 
AttributeError: 'NoneType' object has no attribute 'rstrip'>
sage: fricas(3)
<repr(<sage.interfaces.fricas.FriCASElement at 0x73b6eaa090d0>) failed: 
RuntimeError: An error occurred when FriCAS evaluated 'sage3':
   There are no library operations named category_for
      Use HyperDoc Browse or issue
                             )what op category_for
      to learn if there is any operation containing " category_for " in
      its name.


   Cannot find a definition or applicable library operation named
      category_for with argument type(s)
                                PositiveInteger

      Perhaps you should use "@" to indicate the required return type, or
      "$" to specify which version of the function you need.>
```

### Additional Information

I do not know it is a bug in sage or a bug in the Ubuntu 25.04's fricas.
Can someone check it? But if we use ```sage -i fricas```. The problem is
solved. We need to report to Ubuntu. It is a very strange bug.

### Environment

- **OS**: Ubuntu 25.04
- **Sage Version**: 10.7


### Checklist

- [x] I have searched the existing issues for a bug report that matches the one 
I want to file, without success.
- [x] I have read the documentation and troubleshoot guide

** Affects: fricas (Ubuntu)
     Importance: Undecided
         Status: Confirmed

** Changed in: fricas (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2120312

Title:
  An incompatible bug in the sage.interface.fricas and the system's
  FriCAS in Ubuntu 25.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/fricas/+bug/2120312/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to